I have:
function dosomething(data) {
alert($(this).attr('class'))
$(this).children('img').attr('title', data)
}
$('.test').bind('mouseover', function() {
$.get('/inc/ajax-function.asp?action=check', dosomething);
})
Now this obviously doesn’t work. What I would like to do is this:
When the .get is called get rresult into data (this works) and put the result in title of the img that is a children of the link that you mouseover. How do I get the $(this) value to the function?
<a class='test' href='book.asp><img src='image.gif' title='' /></a>
Thank you for 2 good solutions. I don’t know which one is “better” that is faster and more “standard” to use in this situation.
You can use jQuery proxy function for this: http://api.jquery.com/jQuery.proxy/
Try this: