前端----表格的具体使用(jquery)

  表格在页面布局中常常会用到。在不同的框架中有不同的使用方法,现在,我先总结下表格在jquery中具体使用:

1、增--insertAfter()

 function addTr(){
	 $("<tr><td><input type='checkbox'></td><td></td><td></td><td></td><td></td></tr>").insertAfter(".table tr:eq(1)");
 }

  

2、删--remove()

 function delTr(){
	 $(".table tr:last()").remove();
 }

3、改查询---text()/html()

获取对象,然后赋值

$("#table1 tr:eq(1) td:nth-child(2)").html("valueName"); 

  

5、全选--例子:

  $("#selAll").click(function () {
          $("input[type='checkbox']").prop("checked", $(this).prop('checked'));
      });

  

posted @ 2015-12-25 17:27  renxiaoren  阅读(335)  评论(0)    收藏  举报