3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
textarea auto height textarea { resize: none; } $(document).ready(function() { $("textarea.auto-height").css("overflow", "hidden").bind("keydown keyup", function() { $(this).height('0px').height($(this).prop("scrollHeight") + 'px'); }).keydown(); }); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 <!DOCTYPE html> <html> <head>     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">     <title>textarea auto height</title>     type="text/css">         textarea {             resize: none;         }          type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">     type="text/javascript">         $(document).ready(function() {             $("textarea.auto-height").css("overflow", "hidden").bind("keydown keyup", function() {                 $(this).height('0px').height($(this).prop("scrollHeight") + 'px');             }).keydown();         });      </head> <body>     <textarea class="auto-height"></textarea> </body> </html> [jQuery] textarea自動調整高度 was last modified: 2017-02-06 by Calos

本文由caloskaoorg提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦