Thursday 5 June 2014

Count Number of columns in a table using javascript or jquery


//HTML

<table id="table1">
<tr>
  <td></td>
  <td></td>
  <td></td>
  <td></td>
</tr>
<tr>
</table>
cells
<script>
alert(document.getElementById('table1').rows[0].cells.length)
</script>

//Jquery

 <script type="text/javascript">
       $(document).ready(function () {
              alert($(Table).find('tr')[0].cells.length);
         

       });  
   </script>

No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...