homepage Welcome to WebmasterWorld Guest from 54.167.182.201
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Automatically click link
almo136

5+ Year Member



 
Msg#: 4509818 posted 1:44 pm on Oct 19, 2012 (gmt 0)

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



 
Msg#: 4509818 posted 10:30 am on Oct 22, 2012 (gmt 0)

something like this should do:

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved