How to make the textbox enable on click of radiobutton

Posted on 2013-05-23
Last Modified: 2013-06-07
<asp:radiobutton id="rageinmonths" Text="Months" id="agem" runat="server"/>
<asp:radiobutton id="rageinmonths" Text="Months" id="agem" runat="server"/>
<asp:label id="lblage" Text="" runat="server">
<asp:Textbox id="txtage" runat="Server" Text="" Enabled="false">

How to make the textbox enable on click on any radiobutton.
and the lblage to be assigned as "Age in Months" on click of rageinmonths and similarly for years.
Question by:searchsanjaysharma
  • 2
LVL 42

Expert Comment

ID: 39190431
u have 2 id attributes on each of the radio buttons.
also both are identical, have different ids for them.
LVL 42

Accepted Solution

sedgwick earned 500 total points
ID: 39190463
<asp:radiobutton id="rageinmonths" Text="Months" runat="server"/>
<asp:radiobutton id="rageinyears" Text="Years" runat="server"/>
<asp:label id="lblage" Text="" runat="server">
<asp:Textbox id="txtage" runat="Server" Text="" Enabled="false">

Open in new window

$('#rageinmonths, #rageinyears').click(function(){
    $('#txtage').attr('disabled', '');
	$('#lblage').text('Age in ' + $(this).val());

Open in new window


Author Closing Comment

ID: 39228299

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

Suggested Solutions

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
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)

910 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

21 Experts available now in Live!

Get 1:1 Help Now