Question

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'

Was it helpful?

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");
    });

OTHER TIPS

looks like you want a.openModal as your selector. Currently its selecting a elements inside something with class openModal. You might want to look into delegate instead, iirc thats preferred now.

I see your update. Aren't you supposed to call it with nyroModal, not nyroModalManual? nmManual looks like it might be valid too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top