How to rename jQuery function

How to rename jquery function. let's say I want to rename the JQuery draggble() user interface function to xdraggble() so that it does not conflict with another drag and drop function loaded from another library. Does renaming change performance.

+4
source share
2 answers

Something like this, executed before loading the other script:

 jQuery.fn.xdraggable = jQuery.fn.draggable; 
+8
source
 var xdraggable = $.fn.draggable; //or var xdraggable = $.draggable; 

(depending on implementation)

Same as you if you want to override a function, but still have access.

See this post regarding what I mean by redefining

+2
source

Source: https://habr.com/ru/post/1342224/


All Articles