Home >Web Front-end >JS Tutorial >jQuery gets the radio button selected value and removes all radio selected status examples to share

jQuery gets the radio button selected value and removes all radio selected status examples to share

小云云
小云云Original
2018-01-11 13:57:373345browse

This article mainly brings you a jQuery method to obtain the radio selected value of a radio button and remove all radio selected states. I hope it can help you.

As shown below:

喜欢<input type="radio" name="likea" id="" value="3" /> 
一般<input type="radio" name="likea" id="" value="2" /> 
不喜欢<input type="radio" name="likea" id="" value="1" />

Use jQuery to get the radio selected value

$("input[name='likea']:checked").val()

Remove all radio selected states

$('input:radio[name="likea"]').removeAttr('checked');

Related recommendations:

jQuery implements RadioButton to do the required verification function method sharing

How to use radio in html

input attribute radio The problem of setting checked in does not take effect

The above is the detailed content of jQuery gets the radio button selected value and removes all radio selected status examples to share. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn