JSFiddle - React, Tailwind, and code Playground

by Joe

HTML

<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<select id="s_id">
  <option value="option1">option1</option>
  <option value="option2">option2</option>
  <option value="option3">option3</option>
  <option value="option4">option4</option>
</select>

number:
<input type="text" name="number">

JavaScript

$(document).ready(function() {
  // Values when selected, the number box should be disabled
  var values = ['option2', 'option3'];

  // On selection change of the dropdown
  $("#s_id").change(function() {
    // values.indexOf($(this).val()) > -1
    // Checks if the value selected is from the array
    // Comparison returns true when the value is in array, false otherwise
    $('input[name="number"]').prop('readonly, values.indexOf($(this).val()) > -1);
  });
});