(java script) How can i disable a drop down list?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bhavanirayala
    New Member
    • Jul 2007
    • 25

    (java script) How can i disable a drop down list?

    Hi,

    I want to disable drop down list according to the selection on radio buttons.

    my code
    [HTML] <td > SEARCH </td>
    <td><input type="radio" name="letterOpt ion" ></td>
    <td> <select name="letter"/> </td>
    <td><input type="radio" name="fileOptio n" ></td>
    <td> <select name="fileName"/> </td>
    [/HTML]
    If user selects letterOption then the second fileOption and select list should be disabled.
    How can i acheive this.?
    Last edited by acoder; Aug 22 '07, 10:35 AM. Reason: Code in tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Please use code tags when posting code.

    Use the onclick event handler on the radio button to control the disabling.

    Use the 'disabled' property to disable an element:
    [CODE=javascript]selObj.disabled = true;[/CODE]

    Comment

    Working...