由网友(我十拿九稳就差你一吻)分享简介:我怎么可能,在飞行中,删除空格进入了一个文本框,而人是打字?解决方案 $(函数(){VAR TXT = $(#myTextbox);VAR FUNC =功能(){txt.val(txt.val()代替(/ \ S / G,''));}txt.keyup(FUNC).blur(FUNC);});您必须另行办理模糊...
我怎么可能,在飞行中,删除空格进入了一个文本框,而人是打字?
解决方案 $(函数(){
VAR TXT = $(#myTextbox);
VAR FUNC =功能(){
txt.val(txt.val()代替(/ S / G,''));
}
txt.keyup(FUNC).blur(FUNC);
});
您必须另行办理模糊
事件,因为用户可以使用右键菜单粘贴;)
How could I, on the fly, remove spaces entered into a textbox while the person is typing?
解决方案$(function() {
var txt = $("#myTextbox");
var func = function() {
txt.val(txt.val().replace(/s/g, ''));
}
txt.keyup(func).blur(func);
});
You have to additionally handle the blur
event because user could use context menu to paste ;)
相关推荐
最新文章