Home javascript Set the value disabled = "disabled" in SELECT

Set the value disabled = “disabled” in SELECT




Turning off the fields on the site occurs with the styles specifically by the disabled = “disabled” parameter if at the end to write simply disabled nothing happens

& lt; select id = "otdelenie" class = "b-core-ui-select__select" name = "otdelenie" disabled = "disabled" & gt;
 & lt; option & gt; Select Post Office & LT; / Option & GT;
 & lt; / select & gt;

Question how to install the value disabled = “disabled” in the element using JS in the element.

What is there now, works, but on a clean form without CSS

function gorod_dis () {
  Document.getelementByid ('Gorod'). Disabled = True;
Function Gorod_en () {
  Document.getelementByid ('Gorod'). Disabled = False;

Answer 1, Authority 100%

If I understood the question correctly …

disabled = “disabled” is a tag attribute, not style.

Here is an example of installing an attribute to a specific tag.

document.getelementbyid ('otdelenie'). SetAttribute ('disabled', 'disabled')

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions