Hello all. I'm trying to add an 'onclick' function to an image with jQuery and for some reason it's not sticking. My code looks like:
//create arrow icon/button for li
var img = $('<img></ >').attr('id',i+5)
.attr("src","images/16-arrow-right.png")
.addClass("expImg")
.click(function(){expand(this, 'tdb', 'years', 'danwoods')})
.appendTo(li);
and the resulting element looks like;
<img id="6" src="images/16-arrow-right.png" class="expImg"/>
It completely leaves out the onclick function, but everything else works fine. Does anyone see a problem with my code, or does the error lie elsewhere? Thanks in advance...