Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
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…

895 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

12 Experts available now in Live!

Get 1:1 Help Now