I am binding an accordion tab to open on click and focus. But whenever I click, it executes the function twice. how do i stop this behavior?
I only want it to execute a single event. either click or focus.
$("h2.radioBoxInActive").bind('click focus', function () {
input = $(this).prev("span, input");
$(".selected", app.element).removeClass("selected").slideUp();
$(".radioBoxActive", app.element).removeClass("radioBoxActive");
$("#" + input.attr("data-panel")).slideDown().addClass("selected");
$(this).addClass("radioBoxActive");
});
to avoid a double execution just bind only
focusevent. This will ensure the execution of the handler even when user is using another input device to select the checkbox (e.g. via keyboard)