最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - textarea height and width in jQuery mobile? - Stack Overflow

programmeradmin2浏览0评论

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;');

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;');
Share Improve this question asked Aug 25, 2011 at 17:26 selladuraiselladurai 6,81914 gold badges58 silver badges89 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

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');

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?

发布评论

评论列表(0)

  1. 暂无评论