- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
jQuery :radio Selector
The :radio selector in jQuery is used to select input elements with type radio.
Syntax
The syntax is as follows −
$(":radio")
Example
Let us now see an example to implement the jQuery :radio selector −
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(":radio").wrap("<span style='background-color:yellow'>"); }); </script> </head> <body> <h2>Register</h2> <form action=""> Username: <input type="text" name="user"><br> Set Password: <input type="password" name="password"><br> Reserved:<input type="radio" name="category" value="r"><br> Unreserved<input type="radio" name="category" value="u"><br><br> <button type="button">Submit</button> </form> </body> </html>
Output
This will produce the following output −
- Related Articles
- jQuery :text Selector
- jQuery :visible Selector
- jQuery .class Selector
- jQuery #id Selector
- jQuery :button Selector
- jQuery :checkbox Selector
- jQuery :checked Selector
- jQuery :contains() Selector
- jQuery :disabled Selector
- jQuery :empty Selector
- jQuery :enabled Selector
- jQuery :even Selector
- jQuery :file Selector
- jQuery :first Selector
- jQuery :focus Selector

Advertisements