selladurai
selladurai

Reputation: 6789

textarea height and width in jQuery mobile?

I fixed the the height for text-area element in jQuery mobile and i got perfect height and width in portrait but in landscape the width doesn't enlarge. can any one help me? thanks in advance.

HTML:        <textarea cols="55" rows="50" name="textarea" id="newMarkCompleteCommentText" style="background-color:White;width:95%;height: 50px;"></textarea>

IN JS:
    $('#newCommentText').attr('style', 'background-color:White;font-size:18px;height:7em;');

Upvotes: 3

Views: 10012

Answers (2)

user910533
user910533

Reputation:

If you're setting the width and height, you don't need to set cols and rows. Try removing those values and the textarea should expand with your % values.

Also, is your textareas containing element set to expand?

Upvotes: 1

Ben Lee
Ben Lee

Reputation: 53349

Try setting "width: auto". Also, instead of ".attr('style', ...)" you can use ".css('attribute', 'value')"

$('#newCommentText').css('background-color', 'white').css('font-size', '18px').css('height', '7em').css('width', 'auto');

Upvotes: 2

Related Questions