使用jQuery如何不允许插入新行(通过按Enter键或在文本中复制) – 在半伪代码中…
$('textarea').keydown(function(){ $(this).remove_new_lines(); });@H_301_3@ @H_301_4@谢谢! @H_301_4@编辑: @H_301_4@它会像以下那样粗糙还是有更好的方法?function removeNL(s){ return s.replace(/[\n\r\t]/g,); } $('textarea').keydown(function(){ $(this).val(removeNL($(this).val)); });@H_301_3@