JavaScript's onchange event versus jquery's Change () method _javascript Skills

Source: Internet
Author: User
Change the mindset into a keyboard key event, as follows:
<asp:textbox id= "txtname" runat= "Server" onkeyup= "Fnamechange" (); " ></asp:TextBox>
Here's a bit of a problem: you copy and paste, and you can't trigger this event. Here are some of the relevant code:
Copy Code code as follows:

function Fnamechange () {
if ($ (' #txtName '). Val (). length<6) {
JQuery ("#checkSta"). HTML ("name is too short!"). "). CSS (" Color "," red ");
}else{
Myajax ();
}
}

Here are some of the things you search on the Web:
Copy Code code as follows:

OnLoad () event
$ (function () {//the event was actually followed, but the timing was not correct.
$ (' #txtName '). Change (function () {Fnamechange ();});
})
* * This is someone said with JS implementation, I found that can not be used.
<script language= "javascript" type= "Text/javascript" >
Window.onlad = function () {
document.getElementById (' tx1 '). attachevent ("onchange", Txchange)
}
function Txchange () {
Alert ("");
}
</script>
*/

For the time being, whoever has the real onchange () method, please tell me, thank you.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.