use conventional thinking: $ ("#keyword"). Value is not available because $ (' #keydord ') is not an element at this time, but a jquery object, so you should use: $ ("#keyword"). Val () $ ( "#keyword") [0].value = "]; /*get the value of Text.areatext*/ varTextval = $ ("#text_id"). attr ("value")); //orvarTextval = $ ("#text_id"). Val (); /*get the value of a radio button*/ varValradio = $ ("input[type=radio]:checked"). Val (); /*gets the value of a set of radio selected items named (items)*/ varItem = $ (' input[name=items]:checked '). Val (); /*gets the value of the check box*/ varCheckboxval = $ ("#checkbox_id"). attr ("value"));/*gets the value of the drop-down list*/ varSelectval = $ (' #select_id '). Val (); /*text box, text area*/ $("#text_id"). attr ("Value", ");//Empty contents $ ("#text_id"). attr ("value"), ' test ');//fill content/* Multi box checkbox*/$ ("#chk_id"). attr ("Checked", ");//make it not tick$ ("#chk_id"). attr ("Checked",true);//Tickif($ ("#chk_id"). attr (' checked ') = =true)//determine if you have selected/*single-selection group radio*/ $("Input[type=radio]"). attr ("Checked", ' 2 ');//set the value=2 item as the currently selected item/*Drop- down box select*/ $("#select_id"). attr ("value", ' Test ');//set the Value=test item as the currently selected item$ ("Testtest2"). AppendTo ("#select_id")//option to add a drop-down box$ ("#select_id"). empty ();//empty drop-down box/*gets the value of a set of radio selected items named (items)*/ varItem = $ (' input[name=items]:checked '). Val ();//val () = undefined if not selected/*gets the text of the Select selected item*/ varItem = $ ("Select[name=items] option:selected"). text (); /*the second element of the Select drop-down box is the currently selected value*/ $(' #select_id ') [0].selectedindex = 1; /*Radio The second element of a radio group is the currently selected value*/ $(' Input[name=items] '). Get (1). checked =true; /*Resetting the form*/ $("Form"). each (function() {. reset ();}); jquery values and assigns the HTML element jquery to the base control's value, assignment TEXTBOX:varstr = $ (' #txt '). Val (); $ (' #txt '). Val ("Set Lbl Value");//text box, text area: $ ("#text_id"). attr ("Value", "");//Empty contents $ ("#text_id"). attr ("value", ' test ');//fill contentjquery assigns a value to the base control, and assigns a TEXTBOX:varstr = $ (' #txt '). Val (); $(' #txt '). Val ("Set Lbl Value")); //text box, text area:$ ("#text_id"). attr ("Value", "');//Clear Content$ ("#text_id"). attr ("value", ' Test ');//Populating contentlable:varstr = $ (' #lbl '). text (); $(' #lbl '). Text ("Set lbl Value")); varValradio = $ ("input[@type =radio][@checked]"). Val (); varItem = $ (' input[@name =items][@checked] '). Val (); varCheckboxval = $ ("#checkbox_id"). attr ("value"));varSelectval = $ (' #select_id '). Val (); //multiple marquee checkbox:$ ("#chk_id"). attr ("Checked", "');//make it not tick$ ("#chk_id"). attr ("Checked",true);//Tickif($ ("#chk_id"). attr (' checked ') = =true)//determine if you have selectedRadio Group Radio: $ ("Input[@type =radio]"). attr ("Checked", ' 2 ');//set the value=2 item as the currently selected item//Drop- down box select:$ ("#select_id"). attr ("value", ' Test ');//set the Value=test item as the currently selected item$ ("<option value= ' test ' >test</option><option value= ' test2 ' >test2</option>"). AppendTo ("# select_id ")//option to add a drop-down box$ ("#select_id"). empty ();//empty drop-down boxgets the value of a set of radio selected items named (items)varItem = $ (' input[@name =items][@checked] '). Val ();//val () = undefined if not selectedgets the text of the Select selected itemvarItem = $ ("select[@name =items] option[@selected]"). text (); The second element of the Select drop-down box is the current check value of $ (' #select_id ') [0].selectedindex = 1; Radio the second element of the radio group is the currently selected value $ (' input[@name =items] '). Get (1). checked =true; //Resetting the form$ ("form"). each (function() {. reset ();}); Summary: jquery gives the base control the value, assignment TEXTBOX:varstr = $ (' #txt '). Val (); $ (' #txt '). Val ("Set Lbl Value");//text box, text area: $ ("#text_id"). attr ("Value", "");//Empty contents $ ("#text_id"). attr ("value", ' test ');//fill contentjquery assigns a value to the base control, and assigns a TEXTBOX:varstr = $ (' #txt '). Val (); $(' #txt '). Val ("Set Lbl Value")); //text box, text area:$ ("#text_id"). attr ("Value", "');//Clear Content$ ("#text_id"). attr ("value", ' Test ');//Populating contentlable:varstr = $ (' #lbl '). text (); $(' #lbl '). Text ("Set lbl Value")); varValradio = $ ("input[@type =radio][@checked]"). Val (); varItem = $ (' input[@name =items][@checked] '). Val (); varCheckboxval = $ ("#checkbox_id"). attr ("value"));varSelectval = $ (' #select_id '). Val (); //multiple marquee checkbox:$ ("#chk_id"). attr ("Checked", "');//make it not tick$ ("#chk_id"). attr ("Checked",true);//Tickif($ ("#chk_id"). attr (' checked ') = =true)//determine if you have selectedRadio Group Radio: $ ("Input[@type =radio]"). attr ("Checked", ' 2 ');//set the value=2 item as the currently selected item//Drop- down box select:$ ("#select_id"). attr ("value", ' Test ');//set the Value=test item as the currently selected item$ ("<option value= ' test ' >test</option><option value= ' test2 ' >test2</option>"). AppendTo ("# select_id ")//option to add a drop-down box$ ("#select_id"). empty ();//empty drop-down boxgets the value of a set of radio selected items named (items)varItem = $ (' input[@name =items][@checked] '). Val ();//val () = undefined if not selectedgets the text of the Select selected itemvarItem = $ ("select[@name =items] option[@selected]"). text (); The second element of the Select drop-down box is the current check value of $ (' #select_id ') [0].selectedindex = 1; Radio the second element of the radio group is the currently selected value $ (' input[@name =items] '). Get (1). checked =true; //Resetting the form$ ("form"). each (function() {. reset ();});
jquery values and assignment operation codes for form elements