ALL


  jQuery to check whether checkbox is checked

In Vanilla JavaScript, the correct way of checking whether a checkbox is checked is to get the property checked of the checkbox. Assuming there is an checkbox with id "checkbox1", below line will return true if the checkbox is checked while it will return false if the checkbox is unchecked:document.getElementById("checkbox1").checkedIn jQuery, there are a few ways to check this. The first one is to using the corresponding counterpart of the Vanilla JavaScript, it is to check the checked property.$("#checkbox1").prop("checked")The prop() method will get the value of a property for the firs...

15,565 1       JQUERY CHECKBOX CHECKED ATTR PROP


  Finding selected checkbox items in a JSF dataTable

This is one of those problems that I couldn’t find a complete example for when I needed it, so hopefully this will save somebody else the extra time it took me to piece it together.We frequently need to have data tables in our UI, and allow the user to select a subset of those items for action. In JavaServer Faces, this means having a DataTable, each row having its own checkbox. But when the action is triggered, how to we find which items the user has selected.The first step is to add a boolean property to your objects that can represent the selection. If you have a lot objects in your ...

14,981 1       EXAMPLE JAVASERVER FACES JSF DATATABLE CHECKBOX