I have a modal plugin on my page that shouts on $(document).ready but i also have another function (innerHTML) which puts the <a> 5-10 seconds after the page has been loaded, this way the modal doesn’t work cause it’s only working on the code that was there before it has been loaded.
I was thinking about making a function that will “click” on an existing <a> can it be done?
basically i need that when the <a> will appear it will open up the modal instead of going to chat.php
<a href=\"chat.php\" class=\"iframe\">
any help?
If you use
bindmethod, or directly useonclickon your selectors, it will attach event to that specific control only if selector has results. Try to do same thing usinglivemethod, it will remember your event attachment even if your selector doesn’t have any results, and if same kind of control is added later on, that event is automatically bonded to that control.for example, if you are using
$('#btnSubmit').click(function(){ ... );in document.ready replace it with $(‘#btnSubmit’).live(‘click’,function(){…}); this will fire click event even if you add btnSubmit after page load.