Enable Textbox when radio button selected

Discussion in 'Javascript' started by teddy.am, Jun 10, 2006.

  1. teddy.am

    teddy.am Guest


    I have a set of 6 radio buttons, infront of each one there's a textbox
    i need all textboxes disabled .... once one of the radio buttons is
    selected, the texbox infront of it will be anabled to type in ...

    any fast solution?
    teddy.am, Jun 10, 2006
    1. Advertisements

  2. ----
    <script type="text/javascript">
    var currentEnabled = null;
    function enableElement(elem) {
    if (currentEnabled) {
    currentEnabled.disabled = true;
    elem.disabled = false;
    currentEnabled = elem;
    <form action="">
    <input type="text" name="inp1" disabled="disabled">
    <input type="radio" name="sel" value="1"
    <input type="text" name="inp2" disabled="disabled">
    <input type="radio" name="sel" value="2"
    <input type="text" name="inp3" disabled="disabled">
    <input type="radio" name="sel" value="3"

    You might want to have the textboxes enabled by default and use
    a script to disable them. Then they still work if Javascript is

    Good luck.
    Lasse Reichstein Nielsen, Jun 10, 2006
    1. Advertisements

  3. teddy.am

    teddy.am Guest

    Thumbs up,
    Thanks a bunch

    teddy.am, Jun 10, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.