i want to make the dropdown list uneditable by using javascript on button click

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manishamca
    New Member
    • Mar 2008
    • 17

    i want to make the dropdown list uneditable by using javascript on button click

    i want to make the chociebox uneditable that is the option selected shuld not change after we click a button...
    plz help me.
    Thanx in advance
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    hi ...

    call the following function onclick of your button:

    [CODE=javascript]function set_disabled(va l) {
    var n = document.getEle mentById('my_se lect');
    n.disabled = val;
    }
    [/CODE]
    like this:

    [HTML]<input type="button" onclick="set_di sabled(true);" value="set disabled"/>
    [/HTML]
    the function assumes that your select node has an id="my_select"

    kind regards

    Comment

    • manishamca
      New Member
      • Mar 2008
      • 17

      #3
      i want to make the dropdown list uneditable by using javascript on button click

      i want to make the dropdown option uneditable on clciking a buttob. The code shuld be javascript or html....
      thanx in advance

      Comment

      • manishamca
        New Member
        • Mar 2008
        • 17

        #4
        Thanx.
        the code is working...



        Originally posted by gits
        hi ...

        call the following function onclick of your button:

        [CODE=javascript]function set_disabled(va l) {
        var n = document.getEle mentById('my_se lect');
        n.disabled = val;
        }
        [/CODE]
        like this:

        [HTML]<input type="button" onclick="set_di sabled(true);" value="set disabled"/>
        [/HTML]
        the function assumes that your select node has an id="my_select"

        kind regards

        Comment

        • vee10
          New Member
          • Oct 2006
          • 141

          #5
          Hi,

          solution for the problem

          Code:
          <html xmlns="http://www.w3.org/1999/xhtml" >
          <head id="Head1" runat="server">
              <title>Untitled Page</title>
              <script type="text/javascript">    
              
              function disable()
              {   
            document.getElementById("dropdownlist").disabled = true;
           
              }
              
              </script>
          </head>
          <body>
              <form id="form1" action="">
              <div>
              <select id="dropdownlist">
            <option>123</option>
            <option>234</option>
            </select>
             <input type="button" value="Click" onclick="disable()"/>
              </div>
              </form>
          </body>
          </html>




          Originally posted by manishamca
          i want to make the dropdown option uneditable on clciking a buttob. The code shuld be javascript or html....
          thanx in advance

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5390

            #6
            threads merged ... please don't double post your questions ...

            kind regards
            MOD

            Comment

            Working...