有兩個文本格式完全相同的textarea。 ID是textareaA
和textareaB
。使用鍵盤輸入時調整textarea寬度
我已經設置了一些東西發生textareaA密碼。我的問題是如何設置textareaB
在用戶輸入textareaA
時調整其WIDTH大小?
這是我試過但沒有運氣。
$(document).on("click blur keyup", ".fT", function() { // keyup responds with textareaA
var newWidth = $("#textareaA").val(); //does not work
$("#textareaB").width(newWidth);
});
這裏有http://stackoverflow.com/questions/454202/creating-a-textarea-with-auto-resize – Alexander 2015-02-23 12:48:50
@Alexander一些偉大的答案:謝謝,那是關於scrollHeight屬性。我正在尋找寬度。 – Fergoso 2015-02-23 12:49:42