![]() |
JQuery "trigger" won't work. What am I doing wrong?
Thank you everyone for your help with my jquery problem. I now have two working pieces of code:
Code:
<div id="myselector"><a href="/joke.php"><img src="/images/joke.gif" border="0" /></a></div>Code:
<div id="myselector"><a href="/joke.php"><img src="/images/joke.gif" border="0" /></a></div>Code:
<div id="myselector"><script type="text/javascript" src="/archive/humour.js"></script></div>Thanks again |
I should probably add:
This is my first jquery attempt! PHP and moderate Javascript are all I generally do. |
Some comments
1 - why do you expect that anything happens on hover? You did not specify any mouseover/mouseout or mouseenter/mouseleave handlers ... 2 - The script part that uses the selector '#myselector' is placed before the element with id="myselector". At that point jQuery cannot find the element because it is literally not there yet. So either move the script after the element or use $(document).ready(function() { // your code here }); |
Am I getting any closer???
Code:
<script src="/js/jquery-1.9.1.min.js"></script> |
you could maybe try $(this).find('a').click()
|
Quote:
Code:
<div id="myselector"><a href="/joke.php"><img src="/images/joke.gif" border="0" /></a></div> |
Code:
<div id="myselector"><a href="/joke.php"><img src="/images/joke.gif" border="0" /></a></div> |
http://unitstep.net/blog/2010/04/12/...-using-jquery/
this still applies apparently. I use jQuery for all kinds of things, never realized something so simple wouldn't work the way you think it would. |
| All times are GMT +1. The time now is 04:44 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.