html⽂本框监听粘贴,HTML实时监听输⼊框(input)值的变化代码分享:HTML>
select框操作
$(function(){
var text = "";
// 响应
$('#searchName').bind('input propertychange', function() {
var str = $.trim($(this).val());
if(text!=str){
var c = str;
if(str.length>1){
c = str.substring(text.length,str.length);
html内容文本框
}
var code = c.charCodeAt();
if(code>=65 && code<=90){
// ⼤写字母A~Z
text = text + c;
}else if(code>=97 && code<=122){
// ⼩写字母a~z
text = text + c;
}else if(code>=48 && code<=57){
// 数字0~9
text = text + c;
}else{
//$(this).val(text);
}
//alert(text);
}else{
alert(str);
}
});
})
输⼊内容: