Easyui--easyui-textbox's Onblure event is invalid.

Source: Internet
Author: User

There are many types of labels in easyui form forms, Easyui-validate, Easyui-textbox, Easyui-combox, Easyui-datebox, Easyui-datetimebox, and so on.

When using Easyui-textbox, you want to do some processing through the onblure () event, but the event is not always triggered. One of the most basic and simplest onblure (), how can it not be performed? Because of the cache? Tried many times back and forth, or could not be triggered, so, in other people to try, the result is still not good. This, no longer despise this problem, began to think about the reasons. Finally, the problem is solved, we first look at two lines of code, after reading, you will know the answer.

Using Easyui-textbox:

[HTML]View Plaincopyprint?
    1. <input id= "LoginName"class= "Easyui-textbox" missingmessage= "please fill in the login name" data-options=" Required:true,validtype: ' length[1,5] ' " onblur=" Isexistloginname () ">
<input id= "LoginName" class= "Easyui-textbox" missingmessage= "please fill in the login name" data-options= "Required:true,validtype: ' length[1,5] "onblur=" Isexistloginname () ">



Using Easyui-validatebox:

[HTML]View Plaincopyprint?
    1. <input id="LoginName" class="Easyui-validatebox" missingmessage="Please fill in the login name" data-options="Required:true,validtype: ' length[1,5] '" onblur="Isexistloginname ()">
<input id= "LoginName" class= "Easyui-validatebox" missingmessage= "please fill in the login name" data-options= "Required:true,validtype: ' length[1,5] ' "onblur=" Isexistloginname () ">

Compare two HTML, you see the problem? The DOM structure generated by Easyui-validatebox and Easyui-textbox is not the same.

Easyui-validate type of input box, you can directly trigger the Onblure () event, and Easyui-textbox type of input box, onblure () event need to change a trigger mode:

[JavaScript]View Plaincopyprint?
    1. $ ("input", $ ("#loginName"). Next ("span")). blur (function () {
    2. Alert ("login name already exists");
    3. })

Easyui--easyui-textbox's Onblure event is invalid.

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.