Reputation: 2287
have a table with a radio button inside each . The problem is, the table is already generated for me and there is an event attached on the tds that when they are clicked, the state of the radio button inside is also changed. I do not have control on the scripts generated.
Is there a way to detect the value change on the radio button (no click/keypress) or overwrite the built-in event on the tds? I need to do something when the state of the radio button is checked.
I'm using jQuery and here's my current code:
$( 'input[type=radio]' ).on( 'change', function() {
var $this = $( this );
if( $this.is( ':checked' ) ) alert( 'a' );
} );
Upvotes: 0
Views: 2559
Reputation: 9170
You could add another click event to the td's and trigger the radio buttons change event.
$('td').on('click',function() {
$('input[type=radio]', this).trigger('change');
}
Upvotes: 6