theonlychase
12/1/2017 - 7:58 PM

Replace href attribute if a certain class exists

nextQuery(function() {
    if (nextQuery('body.btob').length) {
      nextQuery('div#crumbs a.nextHierarchyLink.nextHierarchyStoreFront').attr('href', 'https://store.nexternal.com/bus3dproducts/featured-products-c64.aspx');
    }
});

// Another Example of toggling attribute on click
jQuery('.dashicons.dashicons-search.search-icon').click(function() {
    jQuery('form.mega-search').toggleClass('mega-search-closed').toggleClass('mega-search-open');
    jQuery('form.mega-search input:last-child').attr('placeholder', jQuery('form.mega-search input:last-child').attr('placeholder') === '' ? 'Search St. James Winery...' : '' );
});