嗨我需要在这里实现断裂线,因为你可以输入回车,但是再次输入后,没有给出断线。
我制作这个小提琴http://jsfiddle.net/FPN9w/
这是JS代码。
$(function () {
//you have to escaped the - character in a character class
var cleanRx = /[^a-zA-Z0-9 áéíóúÁÉÍÓÚÜüñѨ´,.¿?%&$!¡ªº#"()\-_\/]/g;
$('#title').keyup(function (e) {
var which = e.which;
//avoid useless replacements when <- and -> keys are pressed
if (which === 39 || which === 37) return;
this.value = this.value.replace(cleanRx, '');
}).trigger('keyup'); //perform replacement on initial content (remove if uneeded)
$('#description1').keyup(function (e) {
var which = e.which;
//avoid useless replacements when <- and -> keys are pressed
if (which === 39 || which === 37 || which === 13) return;
this.value = this.value.replace(cleanRx, '');
}).trigger('keyup'); //perform replacement on initial content (remove if uneeded)
});
答案 0 :(得分:1)
在js中添加此代码
$('#description1').keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
这是您更新的JsFiddle http://jsfiddle.net/pratbhoir/FPN9w/3/