By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,028 Members | 1,733 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.

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

P: 17
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
Mar 17 '08 #1
Share this Question
Share on Google+
5 Replies


gits
Expert Mod 5K+
P: 5,330
hi ...

call the following function onclick of your button:

Expand|Select|Wrap|Line Numbers
  1. function set_disabled(val) {
  2.     var n = document.getElementById('my_select');
  3.     n.disabled = val;
  4. }
  5.  
like this:

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

kind regards
Mar 17 '08 #2

P: 17
i want to make the dropdown option uneditable on clciking a buttob. The code shuld be javascript or html....
thanx in advance
Mar 18 '08 #3

P: 17
Thanx.
the code is working...



hi ...

call the following function onclick of your button:

Expand|Select|Wrap|Line Numbers
  1. function set_disabled(val) {
  2.     var n = document.getElementById('my_select');
  3.     n.disabled = val;
  4. }
  5.  
like this:

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

kind regards
Mar 18 '08 #4

100+
P: 141
Hi,

solution for the problem

Expand|Select|Wrap|Line Numbers
  1. <html xmlns="http://www.w3.org/1999/xhtml" >
  2. <head id="Head1" runat="server">
  3.     <title>Untitled Page</title>
  4.     <script type="text/javascript">    
  5.  
  6.     function disable()
  7.     {   
  8.   document.getElementById("dropdownlist").disabled = true;
  9.  
  10.     }
  11.  
  12.     </script>
  13. </head>
  14. <body>
  15.     <form id="form1" action="">
  16.     <div>
  17.     <select id="dropdownlist">
  18.   <option>123</option>
  19.   <option>234</option>
  20.   </select>
  21.    <input type="button" value="Click" onclick="disable()"/>
  22.     </div>
  23.     </form>
  24. </body>
  25. </html>
  26.  
  27.  




i want to make the dropdown option uneditable on clciking a buttob. The code shuld be javascript or html....
thanx in advance
Mar 18 '08 #5

gits
Expert Mod 5K+
P: 5,330
threads merged ... please don't double post your questions ...

kind regards
MOD
Mar 18 '08 #6

Post your reply

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