tags:

views:

27

answers:

4

I am inserting content to a div using jquery like:

$('#divItem').append("<a href='abcd.aspx' class="toolTip" target='_blank'>Go to abcd</a>")

and I am using a jquery plugin to show tooltip on mouse hover the links(that uses class "tooTip").The tooltip works fine for all the links present in the page except the links that I have added with jquery append(). So can any one tell me why this is not working for the links which is added using append()?Is there any solution to this?

A: 

You should use .live method and bind the elements as they are created runtime.

gov
you can even give inline if either of them doesn't work
gov
you can check it out here: http://api.jquery.com/live/
Kennethvr
A: 

It's likely because the plugin is binding events to those links with a method other than $.live() or $.delegate(). Can you provide the plugin source?

mway
A: 

its not that jQuery is not working on links that you add via append. The problem lies with when are you calling your plugin. After the append has happened or before it. jQuery has .live to support such situations at runtime

sushil bharwani
A: 

What everyone has said is correct, you need to bind the tooltip on to the new link you just appended. Add this line after your append line:

$("#divItem a:last").tooltip();
Michael C