So I have following js code:
jQuery('.first_button').click(function(e) {
var get_the_id= jQuery(this).data("custom_id");
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ? true : false;
if(!isMobile) {
// if it is not mobile, the first click needs to trigger this function
jQuery('.second_button_' + get_the_id).custom_plugin();
}else{
//something else
}
})
Here, when the first_button
is clicked, it gets the custom_id
as a variable and looks for second_button_"get_the_id"
class. The issue is that the first click does not trigger the main function ("custom_plugin") and a second click is required.
How can I edit it so that the first click triggers the function (so only one click is required)?