How to find all Checked checkboxes in jQuery? Example Tutorial
Hello guys, suppose you have multiple checkboxes in your HTML page and you want to retrieve all checkboxes which are checked? How will you do that in jQuery? Well, you can use the pseudo selector like :checked to get all checked checkboxes. This selector checks for the checked property of the checkbox and returns only those checkboxes which have this property. For example, the following jQuery selector will return all the checkboxes which are checked:
$('input[type=checkbox]:checked')
In this, we are first selecting all input elements where type is a checkbox and then adding: checked to filter only those which are checked.
$('input[type=checkbox]:checked')
In this, we are first selecting all input elements where type is a checkbox and then adding: checked to filter only those which are checked.
تعليقات
إرسال تعليق