javascript - Add function to the plugin js without actually modifying js file -


I want to add the 'setInputDataId' function to the same level because the existing function 'selection' is actually in the plugin without js file Modifying the file itself so I would like to know how I can add a new function, I appreciate the help.

Existing code in the plugin:

  _select: Select function (data) {this .input.setQuery (datum.value); This.input.setInputValue (datum.value, true); this._setLanguageDirection (); this.eventBus.trigger ("selected", datum.raw, datum.datasetName); this.dropdown.close (); _.defer (_bind (this.dropdown.empty, this.dropdown)); },   

I need the new code:

  _select: Select function (data) {this.input.setQuery (datum.value); This.input.setInputValue (datum.value, true); This.input.setInputDataId (datum.raw); this._setLanguageDirection (); this.eventBus.trigger ("selected", datum.raw, datum.datasetName); this.dropdown.close (); _.defer (_bind (this.dropdown.empty, this.dropdown)); },   

And the 'setInputDataId' function is not originally plugged in, I also want to add this function.

The function body is:

  setInputDataId: set function InputDataId (raw) {This. $ Input.attr ('data-id', raw.id); },   

Please do this in Chrome's console tab:

  console.dir ($ .fn.typeahead)   

Now expand the node function, then click 'Prototype' on Typairhead, then you can see the Tippahs' second closer, then you can see the 'Selected Method'. How can I modify this function.

Hierarchy:

  function & lt; Function scope & gt; Closed (second) typewrite prototype    

as an object to just add it File your script after the addition of the above file.

For example: _ functionName = function () {// implementation};

Already open the console and try it out there.

Enter and press enter, you must give objects contents. Then try the above pseudo code and stop! But unless you add it anywhere in a file explicitly, it will only survive until you close the browser.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -