Variable Visions

Articles jQuery jQuery-Garage-Doors-with-click-target-exclude

tutorials - jQuery and Web-Development.

jQuery Garage Doors with click target exclude

Published Fri. Aug. 03, 2012

Exclude all anchor tags from your jQuery slideToggle function to prevent action before redirect.

While developing my own "garage door" in jQuery, I found that when clicking anchor tags inside the link target the action would start RIGHT before the page redirects to the link.

This line of jQuery will use the .is method and exlude all a tags from the click action.

"When you click on the id box, toggle in a sliding motions the div trigger at a rate of a half second and add the class tabstate2 to tab and also boxstate2 to box."

jQuery('#box').click(function(targetexclude) {
    if( !$("a") ) {

Tag(s): jQuery, is METHOD, slideToogle, toogleClass


PUBLISHED ON 03.3.20arrowWordpress and Woocommerce widget for inserting PHP in Elementor

PUBLISHED ON 09.5.19arrowWordpress and Woocommerce redirect to a product page from categories with a single product