Easyui-textbox and Easyui-validatebox setting values and getting values

Source: Internet
Author: User

The table monoculture is defined as follows: This input uses the Easyui "Easyui-textbox"

1 <  ID= "Addsnumber"  style= "width:200px; height:30px;" class = "Easyui-textbox" type = "text" name = "Snumber" data-options = "Required:true, missingmessage: ' Please enter study number '" />

How to set the value:

1 //using the form selector: The code seems to have an exception2 //$ ("Input[name= ' Snumber ')". TextBox (' SetValue ', "22012");3 //using the form selector: code is not an exception but cannot set a value for input4 //$ ("Input[name= ' Snumber ')"). Val ("22012");5 //using the ID selector: Cannot set a value6 //$ ("#addSnumber"). Val ("22012");7 //using the ID selector: You can set a value8$ ("#addSnumber"). TextBox (' SetValue ', "22012");9 //using the ID selector and settext: You can set the valueTen$ ("#addSnumber"). TextBox (' SetText ', "22012");

So: Setting values for Text-box can only use the ID selector to select form elements, and then use the textbox ("SetValue", value); Set the value in the same way;

The same is true for the Get value:

1  var snumber = $ ("#addSnumber"). TextBox (' GetValue ');

Easyui-validatebox setting values or getting values are a little different.

Table monoculture is defined as follows:

1 <  ID= "Addsnumber"  style= "width:200px; height:30px;" class = "Easyui-validatebox" type = "text" name = "Snumber" data-options = "Required:true, missingmessage: ' Please enter study number '" />

How to get a value:

1 //this way, you can set the value of the2 //$ ("#addSnumber"). Val ("22015");3 //you can set the value4 //$ ("Input[name=snumber]"). Val ("22015");5 //The value cannot be set and the syntax is not an exception6 //$ ("Input[name=snumber]"). TextBox ("SetValue", "22015");7 //The value cannot be set and the syntax is not an exception8 //$ ("Input[name=snumber]"). TextBox ("SetText", "22015");9 //The value cannot be set and the syntax is not an exceptionTen //$ ("#addSnumber"). TextBox ("SetValue", "22015");

So: Validatebox can only set and get values in $ (). Val (), the selector can either use the ID selector or the form selector

Summary: When a FORM element uses Easyui, the textbox and Validatebox set values differently from the way they get the values

Setting a value for Text-box can only use the ID selector to select form elements, use the textbox ("SetValue", Value) or TextBox ("Setext", value) to set the value, using the box ("GetValue") or textbox ("GetText") to get the value;

Set values for Validatebox you can use the ID selector and the form selector, and you can only use Val () to get values and set values.

Easyui-textbox and Easyui-validatebox setting values and getting values

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.