jQuery不是函数 [英] Jqm is not a function

查看:114
本文介绍了jQuery不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Jquery和JqModal时遇到了一些麻烦,并且希望您能够提供帮助,因为我已经奋斗了几个小时..

I'm having some trouble with Jquery and JqModal, and I hope you are able to help, since I've been struggling for hours..

通过运行我的方法"test"的onclick动作具有一个按钮元素(如下所示):

Having a single button element with an onclick action running my method "test" (shown below):

$('#picture_form').jqm({ajax:'/test.php'});

$('#picture_form').jqm({ajax: '/test.php'});

$('#picture_form').jqmShow();

$('#picture_form').jqmShow();

这会将test.php的ajax内容加载到我的div元素picture_form中,如预期的那样使用JqModal进行显示!虽然当我关闭此窗口并重新单击按钮时出现错误:

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不是函数.

$("#picture_form").jqm is not a function.

作为一种解决方案,我尝试使用JqModal触发函数,这使我能够随意打开和关闭JqModal窗口.可悲的是,我只能在测试环境中调用触发器",在生产代码中,我必须使用一个函数打开JqModal窗口.

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?

预先感谢

推荐答案

如果提供内存,则只应调用一次初始化jqm方法.尝试在document.ready事件中初始化模式,然后在onclick中只需要调用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!

这篇关于jQuery不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆