Answers for "disable option if selected"

1

html select option disabled selected

<option selected disabled>Choose Tagging</option>
Posted by: Guest on March-02-2021
0

Disable input if select option checked

$(document).ready(function(){
  $("select.form-control").change(function(){
    $(".home").prop('disabled', $(this).val() == 'home-none');
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select class="form-control">
    <option value="home-none">-</option>
    <option value="home-select">Team</option>
</select>

<div class="form-group">
    <input class="form-control home" name="h-p1-fn" placeholder="First name" type="text"/>
</div>
<div class="form-group">
    <input class="form-control home" name="h-p1-ln" placeholder="Last name" type="text"/>
</div>
Posted by: Guest on October-12-2020

Code answers related to "disable option if selected"

Browse Popular Code Answers by Language