Forum Moderators: open

Message Too Old, No Replies

Automatically click link

         

almo136

1:44 pm on Oct 19, 2012 (gmt 0)

10+ Year Member



I have the below code which shows a stock alert link on out of stock product pages:

if ($block->isShow()): ?>
<p class="alertStock"><a <?php if (!$userLoggedIn): ?> rel="showStockPopupForm" lang="<?php echo $_product->getId() ?>" <?php endif; ?> href="<?php echo $this->escapeHtml($this->getSignupUrl()) ?>"><?php echo $this->__('Sign up to get notified when this product is back in stock'); ?></a></p>
<?php endif; ?>


I would like this link to get triggered automatically. How can I use jQuery to click this link on page load?

Thanks!

lostdreamer

10:30 am on Oct 22, 2012 (gmt 0)

10+ Year Member



something like this should do:

$(window).load(function() {
$(".alertStock a").trigger("click");
});