I have a table with some checkboxes in it, and I've added this code so that when you click on any part of specific table cells, the checkbox is checked. When a checkbox is checked, I need to remove a disabled class from a button in order to allow the user to move to the next step.
This code works fine in Chrome, but in Safari it hangs the window, immediately when $('input:radio', $parent).click() is called.
Is there a more correct way to be doing this?
$('td.info, td.control').click(function() {
var $parent;
$parent = $(this).parent();
$('input:radio', $parent).attr('checked', true);
return $('input:radio', $parent).click();
});
$("input[name='package[order_option_id]']").click(function() {
return ($("#select-interaction-link")).removeClass('disabled');
});
I think the reason for the hang is that you're causing an infinite loop. When the code clicks on the radio button, the click bubbles up to the containing td, which causes your click() handler to be run again.
I think you can solve this with:
$("td.info input:radio, td.control input.radio").click(function(e) {
e.stopPropagation();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With