问题描述
我正在使用我页面上的以下JS文件
Im using following JS file on my page
https://github.com/loopj/jquery-tokeninput/blob/master/src/jquery.tokeninput.js
,但是Im还在同一页面上附加了Prototype.js文件,并且第一个脚本由于Prototype而无法正常工作.谁能告诉我我需要使用
but Im also having Prototype.js file attached on same page and first script is not working because of Prototype. Can anyone tell me what changes I need to make using
var $j = jQuery.noConflict();
因此tokeninput.js可以工作.希望有人明白我想问的是什么.问候.
so tokeninput.js can work. Hope someone understand what Im trying to ask. Regards.
推荐答案
我遇到了同样的情况,但是我找到了一个想与您分享的解决方案就是这个:1)首先插入您的原型和其他库2)插入您的jquery库和令牌输入库,例如:
Hi I was in the same situation but i have found a solution i would like to share with youThis is it:1) Insert your prototype and other library first2) Insert your jquery library and token input library ex:
<script type="text/javascript" src="js/jquery-tokeninput/jquery.min.js"></script> <script type="text/javascript" src="js/jquery-tokeninput/src/jquery.tokeninput.js"></script>
3)插入
<script type="text/javascript">
$.noConflict();
</script>
和
4)插入以下代码,并将所有其他jquery代码放在////
4) Insert the following code and place every other jquery code between the ////
<script type="text/javascript">
jQuery( document ).ready(function( $ ) {
///////////////////////////////////////////////////////////////////////////////
// Code that uses jQuery's $ can follow here.
///////////////////////////////////////////////////////////////////////////////
});
</script>
我做到了,而且效果很好.我有prototype.js,jquery.js,protoplasm,prototypericheditor,prototip.js都在同一页面上运行并做自己的事情.
I did it and it worked perfectly. I have prototype.js, jquery.js, protoplasm, prototypericheditor, prototip.js all running on the same page and doing their own thing.
这篇关于使Prototype和tokeninput.js文件协同工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!