0

I have one div and there are two events associated with it first is a click and another a popover trigger which also gets triggered on click .

Now with first click i need to modify the href attribute of the div and second popover event should pick this modified href and opens up a popover with content fetched from href.

The problem i am facing (looks liek to me ) is second popover triggers still picks up old value and appears to me that the sequence/order in which i registered the events is not maintained . How can I solve this problem.

Here is the my code sample:

retVal = originalURL;

retVal = jQuery('#'+'linkhere').click(getHashPageClick); // thsi function returns a href
(the value is correctly returned )

jQuery('#'+'linkhere').popoverTrigger(retVal); // thsi function opens up a popover with contents fetched from href URL.

but its still picking original URL. Can someone help.

2 Answers 2

1

call the popovertrigger after you call the gethashpage. That should do the trick.

jQuery('#'+'linkhere').click( function() {
  getHashPageClick();
  popOvertrigger();
})

Remember you can specifcy a function to your click function, so you can do a chain of events there

Sign up to request clarification or add additional context in comments.

2 Comments

Is there any other way to get this done. I cannot have more than one function defined inside click .
why cant you have more than one? yes, you can call popovertrigger INSIDE gethashpageclick
0

The problem is the order the events are firing. There may be a tricky solution using event propagation and bubbling and other fancy things, but there's a simpler solution. Just use mousedown!

$('#'+'linkhere').mousedown(getHashPageClick);

Firebug Example

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.