Disable radio button on clicking a checkbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • priyamv
    New Member
    • Jan 2008
    • 17

    Disable radio button on clicking a checkbox

    Hi all,(Its urgent)


    I have a asp:radiobutto and asp:checkbox in my page..
    Once the checkbox is clicked the radiobutton should be disabled ..how can i do it with javascript or AJAX..



    Thanks in advance..
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    that has nothing to do with ajax ... it is simple javascript ... have a look at the following example:

    [CODE=html]<html>
    <head>
    <script type="text/javascript">
    function toggle_node(id, cbn) {
    var n = document.getEle mentById(id);
    n.disabled = cbn.checked;
    }
    </script>
    </head>
    <body>
    <input type="button" id="mb" value="my_butto n"/>
    <input type="checkbox" onclick="toggle _node('mb', this);"/>
    </body>
    </html>
    [/CODE]
    for a radiobutton just change the type of the button to radio and see how it works :)

    kind regards

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Changed the thread title. Please use meaningful titles for any threads started (see the FAQ entry Use a Good Thread Title). In particular, avoid words such as "urgent". It doesn't make the question any more urgent for someone answering your question.

      Comment

      Working...