Skip to content

Instantly share code, notes, and snippets.

@nakajima
Created September 9, 2010 23:04
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 nakajima/e927f7622fa53520959c to your computer and use it in GitHub Desktop.
Save nakajima/e927f7622fa53520959c to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Checkbox Test</title>
<script src="http://code.jquery.com/jquery.js" type="text/javascript"></script>
</head>
<body>
<label>
<input type="checkbox" id="box"> Check Me
</label>
<p>
<a href="#test">Is it checked?</a>
</p>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('a[href="#test"]').live('click', function() {
var input = $('input[name="box"]');
if (input.is(':checked')) {
alert("Yep.")
} else {
alert("Nope.")
}
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment