0

Upon using bootstrap, when I try to disable the drop down list on my page, it does get disabled, however, does not greyed out. Commenting out the bootstrap dependency gets it to work fine.

How can I use bootstrap, and the still have my drop down greyed out upon disabling. Please see my jsbin here.

3 Answers 3

1

There is no Error in Your Code, it is working fine in your jsbin. Just click on Run with JS click on Disable then click on Select element. it is disabled, The center box is for jsbin setting. you can not apply your code on it. don't click on CSS select.

Sign up to request clarification or add additional context in comments.

3 Comments

Hi chbalayesu89, when I click the disable button, I want the drop down list to be greyed out. At the moment, it's not happening because of bootstrap. When I remove the line linking it to the bootstrap library, it gets greyed out correctly. How can I get it to be greyed out upon cliking Disable if I want to use bootstrap.
document.getElementById("elementselect").style="background-color:gray";
why didn't I think of this, I have no idea :) Thanks a lot.
0

Just remove

<script>
    window.onload = init;
</script>

Because it is not defined and generate error.

1 Comment

Hi, sorry about keeping the window.onload = init. But I still see that the drop down list does not greyed out upon clicking the disable button because of bootstrap. How can I get it to be greyed out upon cliking Disable.
0

Just see this simple code working Here

<script>
function disable() {
    document.getElementById("mySelect").disabled=true;
}
function enable() {
    document.getElementById("mySelect").disabled=false;
}
</script>
</head>
<body>

<form>
<select id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
<br><br>
<input type="button" onclick="disable()" value="Disable list">
<input type="button" onclick="enable()" value="Enable list">
</form>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.