JSFiddle - React, Tailwind, and code Playground

by fastsol

HTML

<form name="invoice" action="inv_rec.php" method="post" id="inv" target="invoices" onsubmit="return check_counter();" >
    <table>
    <tr>
       <td>
          <label for="cusname"><strong>Customer Name*&nbsp;</strong></label>
          <input type="text" size="20" name ="cusname" value="" id="Customername"     required/>
       </td>
       <td>
           <label for="for_place"><strong>Place</strong></label>
           <input type="text" size="20" name ="for_place" value=""  id="for_place" />
       </td>
    </tr>
    ........
    <tr>
        <td>
            <input type="submit" value="Generate Invoice" name="submit" id="sub">
        </td>
     </tr>
  </table> 
</form>

JavaScript

$('#sub').click(function(){
    var place = $('#for_place').val();
    var cname = $('#Customername').val();
    
    if(cname='' || place='')
    { alert("Please enter the product details"); }
    else
    { window.open('', 'invoices', 'width=650,height=800,status=yes,resizable=yes,scrollbars=yes'); }
    $('form#inv').each(function(){
	    $(this).reset();

    return false;
});