jquery Gets the value of the Radio,checkbox selection

Source: Internet
Author: User

  This article is mainly on the jquery to obtain the value of Radio,checkbox selection of a detailed introduction, the need for friends can come to the reference, I hope to help you.

$ ("Input[name= ' Radio_name '][checked]"). Val (); Select the value $ ("#text_id") of the selected radio. focus (function () {//code ...}); Event triggers $ ("#text_id") when object text_id gets the focus. blur (function () {//code ...}); Event triggers $ ("#text_id") when object text_id loses focus. Select (); Makes the Vlaue value of the text box selected $ ("Input[name= ' radio_name '][value= ' to select Radio Value '"). attr ("Checked", true); Set Radio to selected state     jquery based on value value   $ ("Input[name= ' Checkbox_name '][checked]"); Select a collection of selected checkbox elements if you want the value you want to traverse this set $ ($ ("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 state of a checkbox (has not been checked, returns True/false) $ ("#checkbox_id"). attr ("Checked", true); Sets the status of a checkbox to be checked (checked=true) $ ("#checkbox_id"). attr ("checked", false); Sets the state of a checkbox to be unchecked (Checked=false) $ ("Input[name= ' Checkbox_name ')"). attr ("Checked", $ ("#checkbox_id"). attr (" Checked "))//According to 3,4,5, you can analyze the meaning of this Code $ (" #text_id "). Val (). Split (", "); The value of text is separated by ', ' to return an array   &nbsp
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.