Mui table for data extraction method


image.png


Gets a collection within the table:

    When there is no table of the field can be filtered using the method:

        var tr=$("#list tr");

         var addResult1=[];

         for(var i=0;i<tr.length;i++){

         var tds=$(tr[i]).find("td");

         if(tds.length>0){

         if($('#c'+(i)+'').is(':checked'))

         {

         addResult1.push({'xuhao':$(tds[1]).html(),'Name':$(tds[2]).html(),'qty':$('#q'+(i)+'').val()});

         }

         }

         }

         var jsonBook=JSON.stringify(addResult1); 

    Use filtered carried out on a field:

        <script type="text/javascript">

         var table = document.getElementById("table1"); 

         var td = table.getElementsByTagName("td");

         var len = td.length;

         for(i=0;i<len;i++){

          alert(td[i].innerHTML);

         } 


Guess you like

Origin blog.51cto.com/yataigp/2447863