Solved

How to make the textbox enable on click of radiobutton

Posted on 2013-05-23
3
238 Views
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.
0
Comment
Question by:searchsanjaysharma
  • 2
3 Comments
 
LVL 42

Expert Comment

by:sedgwick
Comment Utility
u have 2 id attributes on each of the radio buttons.
also both are identical, have different ids for them.
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
Comment Utility
html:
<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


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

Open in new window

0
 

Author Closing Comment

by:searchsanjaysharma
Comment Utility
tx
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

DOM Attributes and Properties treatment with jQuery 1.6 by Ivo Stoykov jQuery (http://jquery.com/) 1.6 introduces .prop() (http://api.jquery.com/prop/) and .removeProp() (http://api.jquery.com/removeProp/) methods which allow modifying or removi…
This article discusses how to create an extensible mechanism for linked drop downs.
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)

771 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