jquery Get form values

Source: Internet
Author: User

Query method to get multiple input values(2011-06-03 01:59:14) reproduced
tags:   Radio Span class= "SG_TXTB" >  text area   element   get   text box   jquery   Multiple   input value     method category:  reprint
1 if ($ ("Input[name=item][value= ' Val ')"). attr (' checked ') ==true)//Determine if the name is the control Name property, value is the control Value property can not specify the property value, Because the value of a set of checkboxes will hold its corresponding ID in the database, it is best to write the IF ($ ("Input[name=row_checkbox]") as follows. attr (' checked ') ==true) {alert ("J");} Else{alert ("Please select data! ");} Alternatively, you can write if ($ ("[Name=row_checkbox]"). attr (' checked ') ==true)   jquery Radio value, checkbox value, select Value, Radio selected , checkbox selected, select selected, and its related   article Category: Web Front end jquery 1.3.2 jquery Radio value, checkbox value, select Value, Radio selected, checkbox selected, Select selected, and its related settings get a set of radio values for the selected item: var item = $ (' input[name=items][checked] '). Val (); Gets the text of the Select selected item var item = $ ("select[ @name =items] option[@selected]). Text (); Gets the literal of the Select selected item: var item = $ ("Select[name=items] option[selected]"). Text (); or $ ("Select[name=items]"). Find ("option:selected"). Text (); the second element of the Select drop-down box is the currently selected value: $ (' #select_id ') [0].selectedindex = 1;select drop-down box value = ' val ' element is currently selected: $ ("Select[name=items] option[value= ' Val ']"). attr ("Selected", "Selected"); Radio the second element of the radio group is the currently selected item: $ (' input[@name =items] '). Get (1). checked = true; or $ (' Input[name=items]. attr ("Checked", ' 1′ '), radio the element of value = ' Val ' is the currently selected item: $ (' input[name=items] [value= ' Val '] '). attr ("Checked", " Checked ");  gets the value: text box, text area: $ (" #txt "). attr (" value "), Multi-marquee checkbox:$ (" Input[name= ' checkbox ': Checked] "). each ( function () {var val = $ (this). val ();}); Radio Group Radio: $ ("input[type=radio][checked]"). Val (); Drop-down box select value: $ (' select '). val (); Drop-down box select the text value selected: $ ("select" ). Find ("option:selected"). text (); Control form elements: text box, text area: $ ("#txt"). attr ("value", "); Empty content $ ("#txt"). attr ("value", ' 11′ '); Fill content The second element of the Checkbox:checkbox box is ticked: $ ("Input[name=items]"). Get (1). checked = true; Tick $ ("input[name=items]"). Get (1). checked = false; Do not tick the checkbox of the value= ' Val ' element before ticking: $ ("Input[name=item][value= ' Val ')"). attr ("Checked", true); or $ ("Input[name=item][value= ' Val ')"). attr ("Checked", "checked"), if ($ ("Input[name=item][value= ' Val ')"). attr (' Checked ')//==true)//Determine if the radio group has been ticked radio: $ ("Input[type=radio]"). attr ("Checked", ' 2′ ');//Set value=2 items as the current Check drop-down box select: $ ( "#sel"). attr ("value", '-sel3′ ');//Set VALUE=-SEL3 item as the currently selected $ ("<option value=" 1′>1111</option><option value= ' 2′>2222</option> '). AppendTo ("#sel")//Add option$ ("#sel") to the drop-down box. Empty ();//emptying the dropdown box jquery Gets the value of the radio selection Code $ ("Input[name= ' Radio_name '][checked]"). Val (); Select the value $ ("#text_id") of the selected radio. focus (function () {//code ...}); The event triggers $ ("#text_id") when the object text_id gets the focus. blur (function () {//code ...}); The TEXT_ID event triggers $ ("#text_id") when the object loses focus. Select (); Make the Vlaue value of the text box a selected $ ("Input[name= ' radio_name '][value= ' to select the value of Radio '). attr (" Checked ", true); Set Radio to the selected state based on value values jquery Gets the value of the checkbox selection of $ ("Input[name= ' Checkbox_name '][checked]"); Select a collection of selected checkbox elements if you want value values you need to traverse this collection $ ($ ("Input[name= ' Checkbox_name '][checked]")). each (function () {arrchk+= This.value + ', ';}); /Traverse the collection of selected checkbox elements to get value $ ("#checkbox_id"). attr ("checked"); Gets the status of a checkbox (there is no selected, returns True/false) $ ("#checkbox_id"). attr ("Checked", true); Set the status of a checkbox to checked (checked=true) $ ("#checkbox_id"). attr ("checked", false); Set a checkbox with a status of unchecked (Checked=false) $ ("Input[name= ' Checkbox_name ')"). attr ("Checked", $ ("#checkbox_id"). attr ("checked"));//According to the 3,4,5 bar, you can analyze the meaning of this code ("#text_id"). Val (). Split (","); Returns an array of value values of text as ', ' delimited

jquery gets form 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.