what is the jquery selector syntax to select this LI item
Posted
by Jonathan Lyon
on Stack Overflow
See other posts from Stack Overflow
or by Jonathan Lyon
Published on 2010-06-06T10:00:26Z
Indexed on
2010/06/06
10:12 UTC
Read the original article
Hit count: 378
hi all
I need to select each list item and change the background image of the parent div homepagecontainer but I can't even select the li element in my script. Here is the code:
<div class="transparent" id="programmesbox">
<ul id="frontpage">
<?php
query_posts('showposts=20&post_parent=7&post_type=page');
if (have_posts()) : while (have_posts()) : the_post();
?>
<li id="<?php the_id() ?>" ><a class="sprite" href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; endif; ?>
</ul>
</div>
I need to do something like this
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$('#frontpage li a').hover(function() {
alert('here');
//CHANGE BACKGROUND IMAGE OF 'homepage_container' to different image depending on which list item is hovered over
}
);
</script>
This is the URL of the site:-
http://www.thebalancedbody.ca/
Thanks so much!!
Jonathan
© Stack Overflow or respective owner