JSFiddle - React, Tailwind, and code Playground

by j08691

HTML

<table>
<tr>
  <td>
    <select class="mySelect">
      <option value="na"></option>
      <option value="1">value 1</option>
      <option value="2">value 2</option>
    </select> 

    <select class="mySelect">
      <option value="na"></option>
      <option value="3">value 3</option>
      <option value="4">value 4</option>
    </select> 
  </td>
</tr>
<tr>
  <td>
    <input type="button" value="click me">
  </td>
</tr>
</table>

JavaScript

function toggleBtn() {
    if ($(".mySelect:eq(0)").val() == "na" || $(".mySelect:eq(1)").val() == "na") {
        $('input[type="button"]').attr("disabled", true);
    } else {
        $('input[type="button"]').attr("disabled", false);
    }
};
$(".mySelect").change(function() {
    toggleBtn();
});
toggleBtn();