tags:

views:

140

answers:

1

Hi all,

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

A: 

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!

Funka
Thanks for your response.I have already tried initializing the Jqm method in a document ready. Though it doesnt seem to make any difference.Here's a snippet of my code:http://pastie.org/990167What I'll hopefully end up being capeable of is binding the jqm function to my custom button in Tinymce.
kris
it looks like you're calling the `jqm` initialization method _twice_? Try combining them into being called just once. I'm not sure if this is the actual problem, but as I said, I believe you're only supposed to call it once...
Funka
Hi Funka,That was the problem actuallyOn my ajax page I was calling it again, which made the function bug somehow.
kris