Check/Uncheck all the checkboxes in a table

后端 未结 7 2106
被撕碎了的回忆
被撕碎了的回忆 2020-12-07 23:28

I have a table with information. The first column of the table have checkboxes. I can add/delete rows with a button by checking the checkboxes. The problem I have now is how

7条回答
  •  感情败类
    2020-12-07 23:31

    JSBin

    Add onClick event to checkbox where you want, like below.

    Select All
    Make
    Model
    Description
    Start Year
    End Year

    In JavaScript you can write selectall function as

    function selectall(source) {
      checkboxes = document.getElementsByName('foo');
      for(var i=0, n=checkboxes.length;i

提交回复
热议问题