Search code examples
javascriptjquerynyromodaljquery-click-event

NyroModal Not Working On Added Links with jQuery


I have this NyroModal:

$('.openModal').nyroModal();

And then I have my Link:

<a href="#sample" class="openModal">this is a test</a>

This works great, it loads my sample modal like it's supposed to, but when I add a link using

$("#mydiv").html('<a href="#sample" class="openModal">this is a test</a>');

It doesn't work, I have tried this

$('.openModal a').live('click',function(e) {
        e.preventDefault();
        $(this).nyroModalManual();
        return false;
});

And this:

$('.openModal a').live('click',function(e) {
        e.preventDefault();
        $(this).nmManual("#sample");
        return false;
    });

But I haven't had any luck, can you think of anything else I could try? What am I doing wrong?

Thanks!

UPDATE: I forgot to mention I get no errors at all in my console

UPDATE 2: I am now getting this error, now that I'm selecting it properly:

Uncaught TypeError: Object [object Object] has no method 'nyroModalManual'


Solution

  • what about his ?

    $('.openModal a').live('click',function(e) {
            e.preventDefault();
            $.nmManual("#sample");
        });
    

    or I guess this selector do you have :

    $('a.openModal').live('click',function(e) {
            e.preventDefault();
            $.nmManual("#sample");
        });