Jquery assigns TEXTBOX: var str =$ ('# txt') to the value of the basic control '). val (); $ ('# txt '). val ("Set Lbl Value"); // text box, text area: $ ("# text_id "). attr ("value", ''); // clear content $ (" # text_id "). attr ("value", 'test'); // fill in the content
Jquery assigns values and values to basic controls
TEXTBOX:
Var str = $ ('# txt'). val ();
$ ('# Txt'). val ("Set Lbl Value ");
1. // text box, text area:
2. $ ("# text_id"). attr ("value", ''); // clear the content
3. $ ("# text_id"). attr ("value", 'test'); // fill in the content
LABLE:
Var str = $ ('# lbl'). text ();
$ ('# Lbl'). text ("Set lbl Value ");
1. var valradio = $ ("input [@ type = radio] [@ checked]"). val ();
2. var item = $ ('input [@ name = items] [@ checked] '). val ();
3. var checkboxval = $ ("# checkbox_id"). attr ("value ");
4. var selectval = $ ('# select_id'). val ();
1. // multiple selection box checkbox:
2. $ ("# chk_id"). attr ("checked", ''); // make it unchecked
3. $ ("# chk_id"). attr ("checked", true); // select
4. if ($ ("# chk_id"). attr ('checked') = true) // you can check whether the selected
1. Single-choice group radio:
2.
3. $ ("input [@ type = radio]"). attr ("checked", '2'); // set the project with value = 2 as the currently selected item
4.
5. // drop-down box select:
6. $ ("# select_id"). attr ("value", 'test'); // set the project with value = test as the selected item
7. $ ("<option value = 'test'> test </option> <option value = 'test2'> test2 </option> "). appendTo ("# select_id") // Add the option in the drop-down box
8. $ ("# select_id"). empty (); // clear the drop-down list
9.
10. Get the value of a set of radio selected items named (items)
11. var item = $ ('input [@ name = items] [@ checked] '). val (); // if not selected, val () = undefined
12. Get the text of the selected select item
13. var item = $ ("select [@ name = items] option [@ selected]"). text ();
14. The second element in the select drop-down box is the selected value.
15. $ ('# select_id') [0]. selectedIndex = 1;
16. The second element of the radio Group is the currently selected value.
17. $ ('input [@ name = items] '). get (1). checked = true;
18.
19. // reset the form
20. $ ("form"). each (function (){
21. reset ();
22 .});
Abstract: Jquery assigns the value of TEXTBOX: var str =$ ('# txt') to the basic control '). val (); $ ('# txt '). val ("Set Lbl Value"); // text box, text area: $ ("# text_id "). attr ("value", ''); // clear content $ (" # text_id "). attr ("value", 'test'); // fill in the content
Jquery assigns values and values to basic controls
TEXTBOX:
Var str = $ ('# txt'). val ();
$ ('# Txt'). val ("Set Lbl Value ");
1. // text box, text area:
2. $ ("# text_id"). attr ("value", ''); // clear the content
3. $ ("# text_id"). attr ("value", 'test'); // fill in the content
LABLE:
Var str = $ ('# lbl'). text ();
$ ('# Lbl'). text ("Set lbl Value ");
1. var valradio = $ ("input [@ type = radio] [@ checked]"). val ();
2. var item = $ ('input [@ name = items] [@ checked] '). val ();
3. var checkboxval = $ ("# checkbox_id"). attr ("value ");
4. var selectval = $ ('# select_id'). val ();
1. // multiple selection box checkbox:
2. $ ("# chk_id"). attr ("checked", ''); // make it unchecked
3. $ ("# chk_id"). attr ("checked", true); // select
4. if ($ ("# chk_id"). attr ('checked') = true) // you can check whether the selected
1. Single-choice group radio:
2.
3. $ ("input [@ type = radio]"). attr ("checked", '2'); // set the project with value = 2 as the currently selected item
4.
5. // drop-down box select:
6. $ ("# select_id"). attr ("value", 'test'); // set the project with value = test as the selected item
7. $ ("<option value = 'test'> test </option> <option value = 'test2'> test2 </option> "). appendTo ("# select_id") // Add the option in the drop-down box
8. $ ("# select_id"). empty (); // clear the drop-down list
9.
10. Get the value of a set of radio selected items named (items)
11. var item = $ ('input [@ name = items] [@ checked] '). val (); // if not selected, val () = undefined
12. Get the text of the selected select item
13. var item = $ ("select [@ name = items] option [@ selected]"). text ();
14. The second element in the select drop-down box is the selected value.
15. $ ('# select_id') [0]. selectedIndex = 1;
16. The second element of the radio Group is the currently selected value.
17. $ ('input [@ name = items] '). get (1). checked = true;
18.
19. // reset the form
20. $ ("form"). each (function (){
21. reset ();
22 .)};