admin管理员组

文章数量:1336079

I have a two level list of Categories. First levels are multiple (more than 30). Also the associated child are a lot From the WP-admin, I would like to check whenever at least one of the second level (child) checkboxes are checked. I will run the jquery function after the #post has been submitted. That part is easy, but how to check if any of the childs have been checked is impossible for me to figure out. Banging my head already for days :)

I have a two level list of Categories. First levels are multiple (more than 30). Also the associated child are a lot From the WP-admin, I would like to check whenever at least one of the second level (child) checkboxes are checked. I will run the jquery function after the #post has been submitted. That part is easy, but how to check if any of the childs have been checked is impossible for me to figure out. Banging my head already for days :)

Share Improve this question asked Jun 28, 2020 at 21:17 jamjam 1732 gold badges3 silver badges15 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Try this selector:

if ($('div#category-all ul.children input:checked').length) {
    // at least one of the child categories is selected
}

本文标签: wp adminCheck with Jquery if second level checkbox from categories are checked