Skip to content

Instantly share code, notes, and snippets.

@infyloop
Created March 5, 2012 11:02
Show Gist options
  • Save infyloop/1977883 to your computer and use it in GitHub Desktop.
Save infyloop/1977883 to your computer and use it in GitHub Desktop.
my collection of js often re-used snippets
// will get the id of the elements in the checkbox iff they are selected.
the html should be:
<input type="checkbox" name="check_box_17" value="17">
<input type="checkbox" name="check_box_18" value="18">
<input type="checkbox" name="check_box_19" value="19">
$("#delete-clients").click(function() {
var arc = [];
$("input:checked").each(function(i, obj) { arc.push($(obj).val()) });
if (arc.length > 0) {
$.post("/ajax/url/", {clients:arc}, function(data){
window.location.reload();
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment