$('.mydesc').keyup(function () {
var len = $(this).val().length;
if(len == 63){
//put line break here
}
});
达到 63 个字符(包括空格)时,光标应移动到下一行 (当我得到进入按钮时的效果)
我怎样才能在 jquery 中做到这一点?
最佳答案
当达到 63
个字符时,您可以使用 \n
添加换行符:
$('.mydesc').keyup(function () {
var len = $(this).val().length;
if (len == 63) {
this.value += '\n';
}
});
关于javascript - 查询 : Put line break (press enter button) on entering certain character in text area,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22859303/