• Skip to content

Menu 1

  • Zug
  • Blog
  • Local
  • Printed
  • Projects
  • Railroad
  • Podcasts
  • Newsletter

Thomas Beutel Art

Menu 1

  • Zug
  • Blog
  • Local
  • Printed
  • Projects
  • Railroad
  • Podcasts
  • Newsletter

Follow us

Follow us on TwitterFollow us on InstagramFollow us on PinterestSubscribe to our Channel on YouTubeFollow us on SoundCloud
AuthorPostedbyThomason March 20, 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>

♡

Posted in javascript, jQuery, Programming

Post navigation

Previous
Next

© 2025MINIMAL

Follow us

Follow us on TwitterFollow us on InstagramFollow us on PinterestSubscribe to our Channel on YouTubeFollow us on SoundCloud
x