Solved

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

Posted on 2013-05-21
2
214 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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 …
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now