[英]jSignature is not a function
I'm trying to use jSignature in my website, but it keeps showing me this error: 我正在尝试在我的网站中使用jSignature,但是它一直向我显示此错误:
Uncaught TypeError: $(...).jSignature is not a function
My code is: 我的代码是:
<div id="signature"></div>
$("#signature").jSignature();
I have Jquery 1.11.1: 我有Jquery 1.11.1:
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>
The Jquery is called before the JS of the function. 在函数的JS之前调用Jquery。
I have also tried to call Jquery Mobile, calls like $('#signature').jSignature({'UndoButton':false,color:"#000000",lineWidth:5});
我也曾尝试调用Jquery Mobile,像$('#signature').jSignature({'UndoButton':false,color:"#000000",lineWidth:5});
这样的调用$('#signature').jSignature({'UndoButton':false,color:"#000000",lineWidth:5});
, etc but it never works. 等等,但它永远无法正常工作。
Can anyone help ? 有人可以帮忙吗?
Well, i fixed the problem. 好吧,我解决了这个问题。 The problem was: I had the Jquery 1.12.4 in my plugins file. 问题是:我的插件文件中有Jquery 1.12.4。 It would work normal in any page, but with the jSignature it made the JS throw an error. 它可以在任何页面上正常工作,但是使用jSignature可以使JS抛出错误。 I removed the Jquery from the Plugins ( but keeped the CDN one ) and now it works fine. 我从插件中删除了Jquery(但保留了CDN一个),现在它可以正常工作了。
I already found many questions about this but never an answer. 我已经发现了很多与此有关的问题,但从未找到答案。 Hope this helps anyone out there. 希望这可以帮助任何人。
Many Thanks 非常感谢
i use jQuery 3.4, had the same issue. 我使用jQuery 3.4,有同样的问题。 Im not quite sure where the problem came from but it was the phantom. 我不太确定问题出在哪里,但这是幻影。 First i added all recommended libs to my project and accessed the element as used to: 首先,我将所有推荐的库添加到我的项目中,并访问用于以下内容的元素:
<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
<script src="/jSignature.min.noconflict.js"></script>
...
$(`#id`).jSignature();
I received the same jSignature is not a function
我收到了相同的jSignature is not a function
Afterwards i assumed the problem might be in jQuery version compatability, so added few lines: 之后,我认为问题可能出在jQuery版本兼容性上,因此添加了以下几行:
<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
<script src="/jSignature.min.noconflict.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
crossorigin="anonymous"></script>
<script>
var jq_1_12 = $.noConflict(true)
</script>
...
jq_1_12(`#id`).jSignature();
it was keeping throw the same error jSignature is not a function
. 它一直抛出相同的错误jSignature is not a function
。
Finally I removed the last changes and jquery 1.12 import. 最后,我删除了最后的更改,并导入了jquery 1.12。 The problem solved it-self, have no idea what have happened. 问题是自己解决的,不知道发生了什么。 But the plugin works now without any explicable reason 但是该插件现在可以正常运行,无需任何明确的理由
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.