?
Solved

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

Posted on 2013-05-21
2
Medium Priority
?
219 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:
sedgwick 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
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)
Suggested Courses

752 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