views:

248

answers:

2

Hi

I set up several textarea's with diffrent sizes as:

<textarea class="markItUp" rows="5" cols="80" name="upstring">

or

<textarea class="markItUp" rows="100" cols="80" name="upstring">

But after the markitup has been applied they are always resized to 18 rows. Why?

I have checked rows with firebug and its unchanged (still 5 or 100) so changing that wont help.

Since I have lots of texts I want to do small edits to I do not what to have a to small or to big area to start with since I already know the appropriate size.

Pleas help

+3  A: 

CSS rules generally override the rows and cols attributes, so rather than rely on those, try sizing your textareas with css 'height' and 'width.'

Alex Sexton
thanks, it helped me produce the solution
UlfR
+1  A: 

After some playing around to understand things I produced the following code to solve my problem:

jQuery(".markItUp").markItUp(mySettings).css('height', function() {
  /* Since line-height is set in the markItUp-css, fetch that value and
  split it into value and unit.  */
  var h = jQuery(this).css('line-height').match(/(\d+)(.*)/)
  /* Multiply line-height-value with nr-of-rows and add the unit.  */
  return (h[1]*jQuery(this).attr('rows'))+h[2]
});
UlfR