javascript - jquery plugin and a Click button -


I think it should be easy, but I failed to do it. I own plugin is a

  (function ($) was {$ .fn.Update = function () {console.log ( "click");}}}) () ;  

And on this page, I want to use it:

  & lt; Script src = "~ / scripts / my.plugin.js" & gt; & Lt; / Script & gt; $ (Function () {$ (".btnUpdate"). Click (function () {// TODO: add function with plugin update ();});});  

But I'm getting a reference error: The update has not been defined and it has been seen that when the page loads, I will not go inside the function, I only $ .fn Using .update and touch directly

using $ you jQuery Can add a new method for selected elements of. $ .fn.Update ();

or

$ ("..."). Update (); $ (foo) .Update () , $ (foo) code> will

Update function


You get an not updated error because you do not have any Update function (which has been announced globally), but $ .fn.update


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -