JSFiddle - React, Tailwind, and code Playground

by Vivek Shah

HTML

<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<table style="width: 90%" id="myTable" class="centered-table table table-bordered">
  <thead>
    <tr>
      <th>Item</th>
      <th>Qty</th>
      <th>Price</th>
      <th>Action</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="width: 60%">
        <input type="text" id="detail" name="detail[]" required><span id="erropr" class="hide"></span></td>
      <td style="width: 10%">
        <input type="number" id="qty" name="qty[]" required><span class="hide">Emapty</span></td>

      <td style="width: 15%">
        <input type="number" id="price" name="price[]" value="vivek" required><span class="hide">Emapty</span></td>
      <td style="width: 12%">
        <div class="inline">
          <input type="button" id="addButton" class="btn btn-primary btn-xs" value="Add" />
        </div>
        <div class="inline">
          <input type="button" id="deleteButton" class="btn btn-primary btn-xs" value="Delete" />
        </div>
    </tr>
  </tbody>
</table>
<input type="button" id="saveBtn" name="saveBtn" class="btn btn-primary" value="Create Order">

CSS

.hide {
  display: none;
}

JavaScript

$('#saveBtn').on('click', function() {
  var detail = $('#detail').val();
  var qty = $('#qty').val();
  var price = $('#price').val();
  if ((detail == '') || (detail == null)) {
    valid = false;
    $('#erropr').removeClass('hide');
    $('#erropr').html('* Enter an item');

  } else {
    $('#erropr').html('');
  }

  // same way for other
});