textarea根据内容自适应高度-显示

版权声明:本样板的所有内容,包括文字、图片,均为原创。对未经许可擅自转载者,本人保留追究其法律责任的权利。 https://blog.csdn.net/qq_42152029/article/details/87620638
 <tr>
  <th>具体描述:</th>
  <td>
<textarea  name='describes'  rows="5" cols="5" class='form-control' style='width:300px;background:white;border: 0px;' placeholder='逐条描述'readonly="readonly" ><?php echo $info->describes;?></textarea>
  </td>
</tr>

//注意:必须写在  textarea 标签下边
<script>  //根据textarea 标签内容自适应高度  
        $.each($("textarea"), function(i, n){
            $(n).css("height", n.scrollHeight + "px");
        })
</script>

猜你喜欢

转载自blog.csdn.net/qq_42152029/article/details/87620638
今日推荐