vendredi 31 mars 2017

Jquery chekbox select all except diabled

I have this jsp code as a header to toggle all checkbox:

<th><input name="checkAll" type="checkbox" onClick="toggleCheck(this, this.form.poFulfill);"/></th>

Each row reads the record whether that checkbox will be disabled or not:

<input type="checkbox" name="poFulfill" value='<%=row.poId.toString()%>'
<%=(row.qtyIn.compareTo(row.qtyOut) == 0))?"disabled":""%>>

I want to select all checkbox that is ENABLED only. I read I need to use jquery so I modified my header to:

<th><input id="chkSelectAll" name="checkAll" type="checkbox"/></th>

And added this:

<script type="text/javascript">
$('#chkSelectAll').click(function () {
var checked_status = this.checked;
$('div#item input[type=checkbox]').not(":disabled").prop("checked", checked_status);
});
</script>

Not working and nothing happens when I click checkbox to select all. Any idea?




Aucun commentaire:

Enregistrer un commentaire