-1
嗨,我需要實現這個破折線在這裏工作,因爲你可以輸入enter,但是在你再次輸入沒有給出破折線。允許「輸入」鍵工作,但沒有給出破折線
我使這個小提琴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)
});
你到底想達到什麼目的? –
可能會幫助你http://jsfiddle.net/FPN9w/1/,在這裏使用'/ [^ a-zA-Z0-9áéíóúÉÉúÓÚÜüñѨ',.¿?%&$!¡ºº#「()\ n \ r \ -_ \//]/g;' – Satpal
Satpal請讓正式答案,你的小提琴正是我需要的=)欣賞!!! –