By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,028 Members | 1,784 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,028 IT Pros & Developers. It's quick & easy.

To invoke a textbox when radio button clicked

P: 1
There 2 radio buttons.when a radio is clicked textbox should appear,when another radio clicked the existing textbox should disappear and new textbox should be enabled.
Sep 23 '08 #1
Share this Question
Share on Google+
4 Replies


Dormilich
Expert Mod 5K+
P: 8,639
sounds like a neat effect.....
Sep 23 '08 #2

hsriat
Expert 100+
P: 1,654
Use onclick event of the radio buttons to display and hide the textareas accordingly. style.display can be useful.
Sep 24 '08 #3

acoder
Expert Mod 15k+
P: 16,027
Not a HTML question. Moved to the JavaScript/DHTML forum.

Moderator.
Sep 28 '08 #4

P: 93
onclick of the radio call a function like this
[HTML]
<input type="radio" id="myRadio" name="myRadio" onclick="enable_disable();"\>
<input type="text" id="myRadioTextone" name="myRadioText" class="optional" style="display:none"/>

<input type="text" id="myRadioTexttwo" name="myRadioText" class="optional" style="display:none"/>[/HTML]

Expand|Select|Wrap|Line Numbers
  1. function enable_disable()
  2. {
  3.  
  4. var textFieldone=document.getElementById('myRadioTextone');
  5. var textFieldtwo=document.getElementById('myRadioTexttwo');
  6. textFieldone.style.display='block';
  7. textFieldtwo.style.display='none';
  8. }
similiarly for the second radio do viceversa
Sep 29 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.