Solved

How to make the textbox enable on click of radiobutton

Posted on 2013-05-23
3
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39190431
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
ID: 39190463
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
ID: 39228299
tx
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
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…

726 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