I have some jquery on a selection of buttons. When this is run the button is clicked automatically (last line of the code) and it fires the 'button clicked' message. When the correct button is manually pressed (one with a category of 'overall_size'), the function runs, the 'button clicked' message is fired, the css on the original button is changed but it is NOT clicked again. It's the same code as appears at the bottom which obviously works fine.
Pressing the 'correct' button should result in the 'button clicked' message firing TWICE and the css changing.
Any ideas what the issue might be?
<script type="text/javascript">
$('.option_select').click( function(e) {
console.log('button clicked');
var category = $(this).data('category');
if(category == 'overall_size') {
$('.btn-byo-group-active.usb_memory_selector').css('color', 'red'); // WORKS
$('.btn-byo-group-active.usb_memory_selector').click(); // NOT WORKING
}
});
// 1st call (automatic)
$('.btn-byo-group-active.usb_memory_selector').click();