Jqm is not a function
I'm having some trouble with Jquery and JqModal, and I hope you are able to help, since I've been struggling for hours..
Having a single button element with an onclick action running my method "test" (shown below):
$('#picture_form').jqm({ajax: '/test.php'开发者_高级运维});
$('#picture_form').jqmShow();
This will load the ajax content of test.php into my div element picture_form, shown using JqModal as its supposed to! Though when I close this window, and re-clicks the button I'm getting the error:
$("#picture_form").jqm is not a function.
As a solution I've tried to use the JqModal trigger function, and this leaves me able to open and close the JqModal windows as many times as I want to. Sadly I can only call the 'trigger' using test environment, in my production code I have to open the JqModal window using a function..
Does anyone have a clue why this 'bug' appears when calling the opening when using a function?
Thanks in advance
This should solve it. Add it at the point where you want to show it:
$('#ex2').jqm({ajax: action,target: 'div.jq_content', trigger: false, modal:true }).jqmShow();
If memory serves, you are only supposed to call the initializing jqm
method once. Try initializing the modal in a document.ready event, then in your onclick you just need to call the jqmShow function. If this still doesn't work, could you post a bit more of the surrounding code? Good luck!
精彩评论