scropio gurl

scropio gurl

  • NA
  • 147
  • 99k

Apply css class on tr and th jquery

Jul 18 2016 7:04 AM

I try to apply class on tr and th i try this but effect did not reflect when i run this

html

<table id="tabledata">  </table>

and

  1. success: function (result) {  
  2. var final = JSON.parse(result.d).response;  
  3. console.log(JSON.parse(result.d).response)  
  4. $("#tabledata").empty();  
  5. $("th").addClass("GridviewScrollHeader");  
  6. $("td").addClass("GridviewScrollItem");  
  7. if (final.length > 0) {  
  8. $("#tabledata").append(  
  9. "<tr><th>ID</th><th>OwnerName</th><th>RegNo</th><th>MileageAccumlation</th><th>MaxSpeed</th></tr>");  
  10. for (var i = 0; i < final.length; i++) {  
  11. if (final[i] !== null) {  
  12. $("#tabledata").append("<tr><td>" +  
  13. final[i][0] + "</td> <td>" +  
  14. final[i][1] + "</td> <td>" +  
  15. final[i][2] + "</td> <td>" +  
  16. final[i][3] + "</td> <td>" +  
  17. final[i][4] + "</td></tr>");  
  18. }  
  19. }  
  20. }  

any solution?>


Answers (2)