Skip to content

Instantly share code, notes, and snippets.

@devjosh12
Created March 20, 2015 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devjosh12/f1727ea82a4f8b9b48f2 to your computer and use it in GitHub Desktop.
Save devjosh12/f1727ea82a4f8b9b48f2 to your computer and use it in GitHub Desktop.
custom js checked
$(function () {
$('.btnGetAll').live("click",function () {
if ($('.chkNumber:checked').length) {
var chkId = '';
$('.chkNumber:checked').each(function () {
chkId += $(this).val() + ",";
});
chkId = chkId.slice(0, -1);
//alert(chkId);
$.ajax({
type:'POST',
url:'delete_products.php',
data:'delete_ids='+chkId,
success:function(data) {
if(data) {
alert(data);
location.reload();
} else { // DO SOMETHING }
}
}
});
}
else {
alert('Nothing Selected');
}
});
$('.chkSelectAll').live("click",function () {
$('.chkNumber').prop('checked', $(this).is(':checked'));
});
$('.chkNumber').live("click",function () {
if ($('.chkNumber:checked').length == $('.chkNumber').length) {
$('.chkSelectAll').prop('checked', true);
}
else {
$('.chkSelectAll').prop('checked', false);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment