Beutelevision

by Thomas Beutel

Month: March, 2010

Detecting a click in a checkbox with jQuery

A simple script to detect when a checkbox is clicked. What you do with once you’ve detected the click is up to you. <html> <head> <script src=”http://www.google.com/jsapi”></script> <script> google.load(“jquery”, “1.3.2”); google.setOnLoadCallback(function() { $(‘#agree’).click( function() { if($(this).attr(‘checked’)){ alert(‘checked’); } else{ alert(‘unchecked’); } }); }); </script> </head> <body> <p> <input id=”agree” type=”checkbox” /> I agree </p> </body></html>

Redirect from within a WordPress admin page

I was trying to perform a redirect to generate a CSV file from within a WordPress admin page using the wp_redirect( ) function, but the problem was that I would always get the dreaded “Cannot modify header information – headers already sent” message. This is because admin plugins are simply hooks that are performed within […]