码迷,mamicode.com
首页 > 其他好文 > 详细

实现输入框高度随内容变化

时间:2017-12-27 17:51:26      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:add   默认   输入框   fun   put   ext   row   his   ace   

<textarea type="text" placeholder="直接填写联系地址" rows="1" id="address-write" maxlength="100"></textarea>
    //填写地址文本域,默认一行显示。输入时,高度随内容变化。
    $(‘#address-write‘).on(‘input‘,function() {
        $(this).css({
            ‘height‘: ‘auto‘
        }).height( this.scrollHeight );
    });

 

实现输入框高度随内容变化

标签:add   默认   输入框   fun   put   ext   row   his   ace   

原文地址:https://www.cnblogs.com/zy20160429/p/8125862.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!