Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught Error: cannot call methods on popup prior to initialization;

I'm developing a page and I import another page with popups on it using @Html.Partial("AddCommentPopup") and on pages where I am using an <a href="#pupupIDhere" data-rel="popup etc..> It works perfectly fine. On this page I need to do it differently though because of the way JQM works with links. So I'm using <div onclick="console.log('divclicked');$('#statusUpdate').popup('open');">. And the console tells me that it is being clicked, but it doesn't open the popup and throws this error: Uncaught Error: cannot call methods on popup prior to initialization; attempted to call method 'open'.

Any idea how to fix this?

like image 940
Cullen Sanderson Avatar asked Nov 16 '12 15:11

Cullen Sanderson


2 Answers

Try initializing the div as a popup first, then open it...

<div onclick="console.log('divclicked');
    $('#statusUpdate').popup();
    $('#statusUpdate').popup('open');">
</div>
like image 150
Gabe Avatar answered Nov 04 '22 11:11

Gabe


like this i did and worked fine for me

 $("#statusUpdate").popup();
$("#statusUpdate").popup('open')

you have to initialize it before opening it

like image 30
Ashisha Nautiyal Avatar answered Nov 04 '22 12:11

Ashisha Nautiyal