omethings it’s the simple things in life that make you really happy. For me yesterday, that was thanks to jQuery. Have you ever wanted to have a check box that, when the user checks it it also checks a lot of other checkboxes? Yeah, of course you have! I wanted to do that yesterday. Now, it’s not the first time I’ve had to do that kind of functionality, but it always came with a bunch of javascript that seemed over the top for what was wanted. With jQuery it just took a line or two of code!
$(document).ready(function() {
$('#selectall').click(function() {
$(":checkbox", $('#checkboxlist')).attr('checked', $(this).is(':checked'));
});
});
And with that, on and off go the other checkboxes.
Marvelous!
No comments:
Post a Comment