JSFiddle - React, Tailwind, and code Playground

HTML

<div id="abc">
  <table class="table">
    <tr>
      <td><select id="attribute1" name="moonweasel">
          <option value="1">1</option>
          <option value="2">2</option>
        </select></td>
    <td><select id="attribute2" name="moonweasel666">
          <option value="1">1</option>
          <option value="2">2</option>
        </select></td>
    
    </tr>
      <tr>
          <td><input type="submit" value="Send me your moonweasel name!">
      </td>   
    </tr>
  </table>
</div>

JavaScript

$('#abc').submit(function(){
$("select[id^=attribute]").find('option:selected').each(function() {
    var qty = $(this).val();
    // get the price cell by moving up a level and searching for
    // the descendant with a class name beginning with `price'.
    // Remove the dollar sign to do math

  
   var name1= $(this).attr("name");
  
    alert(name1 + ' ' + qty);
});   
});