Reputation: 343
If you click on buton
it opens 3 checkbox (one that selects it all and two subinputs).
What I'm trying to do is that if the user clicks for example on Centro de dia
the input remains checked and the other (buton
in this case) gets unchecked. If the user clicks on buton
the other gets unchecked, and if the user clicks on Check/uncheck all it obviously checks all or uncheck them all.
But right now if I click on one of the subinputs, it checks/unchecks but doesn't affect the other one.
This is the code i'm using:
$check_all = $('<label></label>')
.text(GeoMashup.opts.check_all_label)
.prop('for', 'gm-' + taxonomy + '-check-all')
.prepend(
$('<input type="checkbox" />').prop('id', 'gm-' + taxonomy + '-check-all')
.prop('checked', (default_off ? false : 'checked'))
.change(function () {
if ($(this).is(':checked')) {
$legend.find('input.gm-' + taxonomy + '-checkbox:not(:checked)').click();
} else {
$legend.find('input.gm-' + taxonomy + '-checkbox:checked').click();
}
})
Any ideas how to make it work that way?
Upvotes: 0
Views: 179
Reputation: 44
You can use .prop() instead of .attr() if using Jquery 1.6 and above.
Upvotes: 1