jQuery UI 1.8rc3 - Button events on a checkbox
Also mentioned here:
If you turn a checkbox into a button, IE7 and IE8 will ignore any events. Events work fine under FF, Chrome, and Safari.
The following code is an example. The button event will not work in IE7/8. .change() has the same results as .click().
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
- <script src="http://jquery-ui.googlecode.com/svn/tags/latest/ui/minified/jquery-ui.min.js" type="text/javascript"></script>
- <link rel="stylesheet" href="http://jquery-ui.googlecode.com/svn/tags/latest/themes/base/jquery-ui.css" type="text/css" media="all" />
- <script type="text/javascript">
- $(function() {
- $("#checkbox-button").button();
- $(":checkbox").click(function(e){alert("Click!");});
- });
- </script>
- </head>
- <body>
- <input type="checkbox" id="checkbox-button"/><label for="checkbox-button">A checkbox turned into a button</label><br />
- <input type="checkbox" id="checkbox"/><label for="checkbox">A checkbox</label><br />
- </body>
- </html>