Search
 
SCRIPT & CODE EXAMPLE
 

HTML

how to disable input form when select change

<select id="menu">
    <option value="0">News</option>
    <option value="1">Friends</option>
    <option value="2">Other</option>
</select>

<input id="comment" type="text" disabled="true" />

<script>
  document.getElementById('menu').addEventListener('change', function() {
    if (this.value == 2) {
        document.getElementById('comment').disabled = false;
    } else {
        document.getElementById('comment').disabled = true;
    }
});
</script>
Comment

PREVIOUS NEXT
Code Example
Html :: how to upload pdf in html 
Html :: tailwind css radio 
Html :: how to make a distance between a label and input html 
Html :: ico html 
Html :: html form 
Html :: type phone number html 
Html :: express serve html 
Html :: jumbotron bootstrap 
Html :: Validate length with html 
Html :: jquery append html to top of div 
Html :: ion-select cancel text 
Html :: a tag open in new tab 
Html :: bootstrap responsive table 
Html :: info icon in html 
Html :: how to return false in html 
Html :: predefine data list in input tag 
Html :: tablas en html 
Html :: seo tags in html 
Html :: html color pink 
Html :: toggle font awesome icon 
Html :: html input size 
Html :: abbreviations in html 
Html :: posting with forms html 
Html :: html input datetime-local value 
Html :: ngif async pipe 
Html :: html phone link 
Html :: import bootstrap 
Html :: link fa fa icon 
Html :: how to align image in right in html 
Html :: html add vertical space below 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =