I cannot remove the prototype from the JSF framework (RichFaces 3.3.3). And if I try noConflict and try to take on $, it will break my application infrastructure because it is closely related to the prototype.
So there is a way I can do this:
jQuery(function() { /* some code that within this domready function allows me to use $() within this function and not interfere with $ being used for prototype outside? */ });
Yes, it is already passed as the first parameter to your handler ready, just use:
ready
jQuery(function($) { $("selector").doSomething(); }); //$ is still prototype here
In general, you can write var $ = jQuery;to replace a character $within a single function.
var $ = jQuery;
$
.
by taking this link as a link, you can do something like this:
jQuery(function($) { // like Nick Craver });
and call the functions that are needed for jQuery:
var yourFunction = function(){ var $ = this; }; yourFunction.call(jQuery); ... var yourFunction = (function($){ return function() { // $ -> jQuery }; })(jQuery); ... var yourFunction = (function(){ var $ = this; return function() { // $ -> jQuery }; }).call(jQuery);
Standard in my workgroup:
jQuery.noConflict(); (function ($) { //Do jQuery stuff using $ here. })(jQuery); //Do prototype stuff using $ here
Source: https://habr.com/ru/post/1768924/More articles:Is it okay to wrap JSF components generated by html with native divs using jQuery after page loading? - jqueryquery in sql database - sqlPostGIS: multipolygon bounding box - sqlcounter_cache не уменьшается для has_many ассоциаций в ActiveReord - ruby-on-railsКак выйти из интерактивного режима в Python - pythonVB.net findwindow / findwindowex - vb.netRuby OAuth Nightmare: Using the Contact API - ruby | fooobar.comThe task of the sorting algorithm - algorithmДоступ к объектам jquery с селекторами - jquery-selectorsfast transcode gstreamer - javaAll Articles