Home > Web Front-end > JS Tutorial > Detailed explanation of Jquery getting the value selected by radio

Detailed explanation of Jquery getting the value selected by radio

小云云
Release: 2018-01-12 11:32:12
Original
1864 people have browsed it

This article mainly introduces the relevant knowledge of Jquery to obtain the radio selected value, which has a good reference value. Let's take a look with the editor below, I hope it can help everyone.

Without further ado, please take a look at the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.php.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.php.org/1999/xhtml">
 <head>
 <title> new document </title>
 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
 <link rel="stylesheet" type="text/css" href="" />
 <style type="text/css"></style>
 <script type="text/javascript" src="jquery-3.0.0.js"></script>
 </head>
 <body>
 <input type="radio" name="radio" value="1" />1<br/>
 <input type="radio" name="radio" value="2" />2<br/>
 <input type="radio" name="radio" value="3" />3<br/>
 <input type="radio" name="radio" value="4" />
 <script type="text/javascript">
 var a = $("input[name=&#39;radio&#39;]:checked").val();
 alert("选中的radio的值是:" + a);
</script>
 </body>
</html>
Copy after login

Related recommendations:

##jQuery gets the radio button selected value and removes all radio selections Status Example Sharing

WeChat Mini Program Detailed Example of Radio Selected Style Switching

Example of How to Use JavaScript to Set Radio Selected

The above is the detailed content of Detailed explanation of Jquery getting the value selected by radio. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template