I'm creating a click function for a set of links that changes the background image of each of those links( different images for each link).
What I have is this:
Code:
$(document).ready(function(){
$('#nav a').click(function() {
//$('#hlink').css({ backgroundImage : "url(images/home_animate.jpg)" });
});
where #nav is the id for the div containing the links and #link being the id of one of the links.
this all works fine, but what I want is
this:
Code:
$('\'#' + $element + '\'').css({ backgroundImage : "url(images/home_animate.jpg)" });
where $element stores the id of the link clicked.
I can get $element to store the id of the link clicked but when I try to append
$element to the
.css({ backgroundImage : "url(images/home_animate.jpg)" }); it doesn;t work
any help would be great.
Thanks