Easyui-textbox and Easyui-validatebox set values and get values
The table is defined as follows: The input uses Easyui's "Easyui-textbox"
<input id= "Addsnumber" style= "width:200px"; height:30px "class=" Easyui-textbox "type=" text "name=" Snumber "data-options=" Required:true, Missingmessage: ' Please enter the school number ' "/>
How to set values:
1//Use form selector: The code appears to have an exception of
2//$ ("Input[name= ' Snumber ')"). TextBox (' SetValue ', ' 22012 ');
3//Use form selector: Code has no exception but cannot set value
4//$ ("Input[name= ' Snumber ')" for input. Val ("22012");
5//Use ID selector: Cannot set value
6//$ ("#addSnumber"). Val ("22012");
7//Using ID selector: You can set a value of
8 $ ("#addSnumber"). TextBox (' SetValue ', "22012");
9//using ID selector and SetText: You can set a value of
$ ("#addSnumber"). TextBox (' SetText ', "22012");
So: Setting values for Text-box can only select form elements using the ID selector, and then use the textbox ("SetValue", value); The way to set the value;
The same is true for getting values:
var snumber = $ ("#addSnumber"). TextBox (' GetValue ');
Easyui-validatebox the set value or get the value is a little different
The table is defined as follows:
<input id= "Addsnumber" style= "width:200px"; height:30px "class=" Easyui-validatebox "type=" text "name=" Snumber "data-options=" Required:true, MissingMessage: ' Please enter the number ' "/>
How to get the value:
1//This way it is possible to set a value of
2//$ ("#addSnumber"). Val ("22015");
3//Can be set to a value of
4//$ ("Input[name=snumber]"). Val ("22015");
5//Can not set the value, and the syntax is not the exception
6//$ ("Input[name=snumber]"). TextBox ("SetValue", "22015");
7//Can not set the value, and the syntax is not the exception
8//$ ("Input[name=snumber]"). TextBox ("SetText", "22015");
9//Can not set the value, and the syntax is not abnormal
//$ ("#addSnumber"). TextBox ("SetValue", "22015");
So: Validatebox can only use the $ (). Val () method to set and get values, selectors can either use ID selector or form selector
Summary: When a FORM element uses Easyui, the TextBox and Validatebox set the value and get the value differently
Setting values for Text-box you can only select form elements using the ID selector, you can only use a textbox ("SetValue", value) or a TextBox ("Setext", value) to set the value, using a TextBox ("GetValue") or textbox ("GetText") gets the value;
Set values for Validatebox you can use the ID selector and the form selector to get values and set values only using Val ().