Click function not fire on first time page load
Hi everybody,
I am using jQuery to bind an event on element click, like this:
jQuery('.product-info-main-content .product-add-form .details-qty .plus').click(function(){
var val = parseInt(jQuery(this).closest('.control').find('input#qty').val());
jQuery(this).closest('.control').find('input#qty').val(val+1);
});
But, the problem is that code not working at the first time page load, I try to refresh the page and it work perfectly. And one more except that if at the first time page load, I open the chrome developer tools, the code is working too.
I'm sure the code is in jQuery(document).ready(), and it's only not work at the first time page load.
Sorry for my bad English. Can anyone give me a solution for this?