How to implement “select all” check box in HTML?

前端 未结 29 2857
悲哀的现实
悲哀的现实 2020-11-22 11:09

I have an HTML page with multiple checkboxes.

I need one more checkbox by the name \"select all\". When I select this checkbox all checkboxes in the HTML page must b

29条回答
  •  攒了一身酷
    2020-11-22 11:34

    JavaScript is your best bet. The link below gives an example using buttons to de/select all. You could try to adapt it to use a check box, just use you 'select all' check box' onClick attribute.

    Javascript Function to Check or Uncheck all Checkboxes

    This page has a simpler example

    http://www.htmlcodetutorial.com/forms/_INPUT_onClick.html

提交回复
热议问题