Click here to Skip to main content
Click here to Skip to main content

Tagged as

Enable Disable Textboxes based on CheckBox using JavaScript

, 10 Dec 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Welcome again, here is one more trick to enable or disable the multiple textboxes based on the check box event.
Please write the following code in Script area of the page.
<script type="text/javascript">
    function enableDisable(bEnable, textBoxID, textBoxID2)
         document.getElementById(textBoxID).disabled = !bEnable
         document.getElementById(textBoxID2).disabled = !bEnable
Put the controls as shown below in the Form area...
<asp:TextBox ID="t1" Text="" runat="server" />
 <asp:TextBox ID="t2" Text="" runat="server" />
 <asp:CheckBox ID="chk1" Checked="true" onclick="enableDisable(this.checked, 't1','t2');" runat="server" />
and let it behave as it's done....
Browse the page and check that out!
Please visit me at .....


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ravi Tuvar
Technical Lead IntelliMedia Networks, Inc
India India
No Biography provided
Follow on   Twitter   LinkedIn

Comments and Discussions

QuestionRegarding to demo Pinmemberankitpatel101011-Oct-12 23:28 
Questionhi dude .. Pinmemberankitpatel101011-Oct-12 23:26 
AnswerRe: hi dude .. PinmemberRavi Tuvar14-Oct-12 23:28 
GeneralReason for my vote of 5 good and simple logic Pinmemberarun-ice29-Jan-12 22:56 
GeneralReason for my vote of 5 Good solution - better and more read... PinmemberEdward Nutting21-Dec-11 1:24 
Generalmy 5+.. PinmemberPrince Antony G13-Dec-11 19:59 
GeneralReason for my vote of 5 simple logic. PinmemberPrince Antony G13-Dec-11 19:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150302.1 | Last Updated 10 Dec 2011
Article Copyright 2011 by Ravi Tuvar
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid