Home  >  Article  >  Web Front-end  >  Comparison of javascript's onchange event and jQuery's change() method_javascript skills

Comparison of javascript's onchange event and jQuery's change() method_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:45:43905browse

Change the idea into a keyboard key event, as follows:

Here One problem is that the content you copy and paste cannot trigger this event. Here are some related codes:

Copy code The code is as follows:

function fNameChange(){
if($('#txtName').val().length<6){
jQuery("#checkSta").html("Name is too short!").css("color"," red");
}else{
myajax();
}
}

Here are some contents searched online:
Copy code The code is as follows:

//onload() event
$(function(){//The event is indeed It was added, but the timing of execution is wrong.
$('#txtName').change(function(){fNameChange();});
})
/*This is what someone said. js implementation, I found that it cannot be used.

*/

For now Solution, if anyone has a real onchange() method, please tell me, thank you.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn