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?
- <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?
- <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?
- $ ("input", $ ("#loginName"). Next ("span")). blur (function () {
- Alert ("login name already exists");
- })
Easyui--easyui-textbox's Onblure event is invalid.