Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to make one of 3 radio button to be checked using  jquery.

Posted on 2013-05-21
2
Medium Priority
?
221 Views
Last Modified: 2013-06-07
I have 3 radio buttons like
<asp:radiobutton id="r1" runat="server" Text="Pf"/>
<asp:radiobutton id="r1" runat="server" Text="Pv"/>
<asp:radiobutton id="r1" runat="server" Text="Invalid"/>

I want the user should click atleast once otherwise the message should come.
0
Comment
Question by:searchsanjaysharma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 1500 total points
ID: 39186635
add GroupName="radiobuttons" to each on of the asp:radiobutton and use this:
<asp:radiobutton id="r1" runat="server" Text="Pf" GroupName="radiobuttons"/>
<asp:radiobutton id="r1" runat="server" Text="Pv" GroupName="radiobuttons"/>
<asp:radiobutton id="r1" runat="server" Text="Invalid" GroupName="radiobuttons"/>

 if ($("input[name='radiobuttons']:checked").length) {
           // at least one of the radio buttons was checked
      }
      else {
           // no radio button was checked
      }

Open in new window

0
 

Author Closing Comment

by:searchsanjaysharma
ID: 39228356
tx
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

DOM Attributes and Properties treatment with jQuery 1.6 by Ivo Stoykov jQuery (http://jquery.com/) 1.6 introduces .prop() (http://api.jquery.com/prop/) and .removeProp() (http://api.jquery.com/removeProp/) methods which allow modifying or removi…
Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question