views:

157

answers:

1

I've been having problems getting jqmodal modal dialogs to display on links added dynamically by client side code. I've demonstrated the problem at the following URL: http://www.neil-burton.co.uk/jqmodaltest/index.htm

Any help would be appreciated

+2  A: 

You can use .live for the anchor click events

UPDATED AGAIN

  $('#dialog').jqm({ajax:'@rel'});

  // open the modal whenever anchor links on the page are clicked
  $('a.someClass').live('click',function(){
      $('#dialog').jqmShow(this);
  });
redsquare
Thanks for your help redsquare. In my live example I need to populate the modal dialog with content via ajax. The URL for the ajax is taken from the rel attribute of the triggering link. That link is dynamically generated by the server, so the links look like this:<a class="addnotetrigger" href="#" rel="ajax.asp?id=1">Link</a><a class="addnotetrigger" href="#" rel="ajax.asp?id=2">Link</a>
The dialog is blank because @rel has no reference I'm guessing. If I replace @rel with ajax.htm, then the script works so far as any new links cause the modal dialog to appear when clicked. I need to be able to set the ajax property from the rel attribute of each link.
ahh. The plugin writer does not provide an un-obfuscated version of his code. It is a nightmare to debug.....My advice would be to look for a decent plugin!
redsquare
Thanks again for your help on this. I'm annoyed with myself. I've done quite a lot of work utilising this plugin, only to come up against this problem towards the end of my project. It's unfortunate the developer doesn't follow normal jQuery plugin creation conventions providing an un-obfuscated version of his code. I also tried to pick my way through it and it's not easy! It's a great plugin otherwise.
Found it : http://dev.iceburg.net/jquery/jqModal/jqModal.dev.js