Skip to content Skip to sidebar Skip to footer

Add Function To The Plugin Js Without Actually Modifying Js File

I want to add 'setInputDataId' function at same level as the existing function '_select' is, in plugin js http://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.js

Solution 1:

As _ is just an object simply add it to your script file following the addition of the above file.

For example:

_.functionName = function() { //implementation };

First off just open up the console and try it there.

Enter _ and hit enter, you should be given the objects contents. Then try the above pseudo code and off you go! But obviously unless you add it to a file somewhere it will only live until you close the browser.


Post a Comment for "Add Function To The Plugin Js Without Actually Modifying Js File"