JSFiddle - React, Tailwind, and code Playground

by Berguiga

HTML

<form  id='form1'>   
 <table border="1" id='tableId'>
   <tr>
       <td>Chck</td>
       <td>Name</td>
   </tr>
   <tr>
       <td><input type='checkbox' value="1"/></td>
       <td >
           <input type="text" name="electronicsId" value="T0"/></td>     
    </tr>
    <tr>
       <td><input type='checkbox' id="check"/></td>
       <td >
           <input type="text" name="electronicsId" value="T1"/></td>     
           
    </tr>
    <tr>
       <td><input type='checkbox' id="check"/></td>
       <td >
           <input type="text" name="electronicsId" value="T2"/></td>     
    </tr>     
    </table>
    
        <div id='myDiv'>
            <input type='checkbox' value="5"/>T3<br/>
            <input type='checkbox' value="6"/>T4<br/>
            <input type='checkbox' value="7"/>T5<br/>
        </div>
    
 <input type="submit" value="submit" id='submitButton' />
  
</form>

JavaScript

$('#submitButton').bind('click', function() {
     var idSelector = "tblDataTable";
     var tblDataTable = new widgetVar(idSelector);
     var selectedItems=tblDataTable.getNumValuesSelected();    
    alert('selectedRows '+selectedItems);
    return false;
});

function widgetVar(idSelector) {
  this.idSelector = idSelector;
}

widgetVar.prototype.getNumValuesSelected = function() {
      var mySelector = $('#'+this.idSelector+' input:checked');
      var cpt = 0;
      mySelector.each(function() {
            cpt++;
        });
    return cpt; 
};