Disable all check boxes inside a table with jquery

前端 未结 7 1455
北海茫月
北海茫月 2021-01-04 11:09

I need to disable all the check boxes inside a table cell when clicking on a hyperlink inside the same table.

I\'m using the following jquery code to select all the

7条回答
  •  旧时难觅i
    2021-01-04 11:50

    Disable?

    $("a.clickme").click(function(){
      $(this)                    // Link has been clicked
        .closest("td")           // Get Parent TD
        .find("input:checkbox")  // Find all checkboxes
        .attr("disabled", true); // Disable them
    });
    

    or Checked?

    $("a.clickme").click(function(){
      $(this)                    // Link has been clicked
        .closest("td")           // Get Parent TD
        .find("input:checkbox")  // Find all checkboxes
        .attr("checked", false); // Uncheck them
    });
    

提交回复
热议问题