简体   繁体   中英

How to rename a jQuery plugin

I am working on a custom control which would be used in many others application. The control contains its own resources which include jquery and the other plugins' scripts required by my control. Now problem arises when the control is inserted in another application which has the same plugins' javascripts included. I have made some changes to the scripts in my control, but now as the name conflicts, when the javascript function is called for initializing the plugins, it uses the scripts that are in the project rather than the control's resources. For resolving this, i thought changing all the string "abc" (as i use myControl.abc() in my code)in plugin script would do it, but it is not working. Changing the string to "abcde" and then using myControl.abcde() gives the error "has no method 'abcde' ". I am trying to rename tokenInput script. Below is the code, please suggest the changes I should do to initialize my control with tokenInputES instead of tokenInput.

I couldnt copy the code, but the script can be found at

https://github.com/loopj/jquery-tokeninput/zipball/jquery-tokeninput-1.6.0

Change line 123:

$.fn.tokenInput = ...

into

$.fn.yourName = ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM