1.8rc1 Events with checkbox and Button
Hello,
I am playing with the new Button feature. I have two issues.
1. I can't get it to work with the click event. Consider the example :
- <p>
<input type="checkbox" id="check" />
<label for="check">Click me !</label>
</p>
<script type="text/javascript">
$('#check').button({
click: function() {
console.log('button click');
}
});
$('#check').click(function() {
console.log('input click');
});
</script>
Outputs after each click (in firebug) :
-
input click
input click
But no 'button click'. Am I missing something ?
2. How to force check/uncheck of a checkbox-button ?
I tried :
- <p>
<a href="#" id="titi">Push the button</a>
</p>
<script type="text/javascript">
$('#titi').click(function() {
$('#check').attr('checked', true);
return false;
});
</script>
This code has no effect on #check.
Thank you for your answers, this new Button is really awesome !
Thomas