-1

I am working on a tip popup windows for my project. When the user clicks the 'turn on tips' button, the tips windows will show next to some elements.

My problem is that I have elements created from ajax that need to have tips window shown next to them as well and if the user clicks the button BEFORE ajax call, those element won't have tips windows shown because they didn't exist. Are there any suggestions to this problem? Thank a lot.

2
  • 1
    Do you have some code to show us? Thanks! Commented Aug 23, 2012 at 1:36
  • How do you set tips before any ajax cals are made? Commented Aug 23, 2012 at 1:36

2 Answers 2

2

You could use on() to act as a delegate for dynamic elements to bind events. Below, I am registering click events to any event that now or later exists on the document with a class called tips.

$(document).on('click','.tips', function(){
   // show tips;
});
Sign up to request clarification or add additional context in comments.

Comments

1

I solve issues like this by having a function I call dommods(). When called, it applies any effects I want to the document, such as tooltips. I simply call it after every change to the DOM, and that solves the problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.