Bootstrap textarea dynamic rows/height

Have a form with a two column layout built in Bootstrap that collapses to a single column at the small breakpoint. All fine.

Have a couple of textareas in one of the columns that have their rows set for the two column view but, ideally, should display a different number of rows (less) at the small breakpoint.

How can I best control what is effectively the display height of a textarea between breakpoints?

Thanks.
 

krimhorn

Ars Legatus Legionis
39,865
A textarea's number of rows is set by the rows attribute on the control so just using CSS isn't going to be enough to change that. Since Bootstrap defines the breakpoints by absolute pixel width you could do something like (using jQuery for simplicity)

Code:
$(window).on('resize', () => {
  if(window.innerWidth <= '576')
    $('#textareaId').attr('rows', 2);
});

Haven't actually tested this code but it should be able to put on you on the right track.