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 a开发者_运维百科ppears 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.
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
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);
精彩评论