Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Expert,

In my project i have used a "Zebra Dialog" .

Click here to go Zebra Dialog examples.

Every thing is working fine expect one condition.

Here is the below code to open a popup

HTML
<a href="javascript:void(0)" id="open-popup">click Here</a>


I need to produce the above link dynamic..
So i have used append method using javascript..

JavaScript
$("#test").append('<a href="javascript:void(0)" id="open-popup">click Here</a>');


when i used the above code in documet ready function..

Then it is working fine....

BUT

When i used the append code inside the ajax sucess event, then it is not working.. means,
the links are printed correctly, but the popup is not appear when i click the link....

Please help me to correct it..

Thanks and regards,
Dileep
Posted
Updated 27-May-13 3:07am
v2
Comments
Can you created a jsfiddle ?
I will take a look at it and try to resolve the issue.
dilzz 27-May-13 10:25am    
How can i fiddle sir,
coz only this happens in Ajax sucess method...

When i used this in ajax beforeSend method then its works fine..

it happends only in sucess method...
And i am using Asp.net project....

Thank you...
Mac12334 28-May-13 7:55am    
Can you please share you code?
Mac12334 28-May-13 7:57am    
I think
$(document).ready(function() {
$("#test").append('click Here');
// show a dialog box when clicking on a link
$(anchor).bind('click', function(e) {
e.preventDefault();
$.Zebra_Dialog('The link was clicked!');
});

});

above code is working but if you mention the append code in the ajax success then the click event is not working ?????

1 solution

Hello,

Try this solution

add class class="testPopup" in :

$("#test").append('< href="javascript:void(0)" class="testPopup" id="open-popup">click Here');

$('.testPopup').live('click',function(e){
//your code...
});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900