Solved

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

Posted on 2013-05-21
2
216 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
2 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
The viewer will learn how to dynamically set the form action using jQuery.
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…

825 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