How will I change the dollar sign (alias for 'jquery') used in jquery with another character. For example
$("#id").css("height","210px");
I want to change this to
*("#id").css("height","210px");
Another way to avoid the need to spell jQuery every time you apply the script is by entering no conflict mode. This allows you to replace the dollar sign with the j$ alias but you can define a different symbol later.
Explanation: Instead of using the $ (dollar sign), we can use jQuery as a function name. For example: jQuery(document). ready(function() { jQuery("p").
The jQuery object :) From the jQuery documentation: By default, jQuery uses "$" as a shortcut for "jQuery" So, using $("#id" ) or jQuery("#id") is the same.
In jQuery's case, $ is just an alias for jQuery, so all functionality is available without using $ . If you need to use another JavaScript library alongside jQuery, return control of $ back to the other library with a call to $. noConflict() .
You cannot change $
to *
because *
is not a valid identifier. But you can change it to a valid one:
(function (foobar) {
foobar("#whatever").css(....)
})(jQuery);
Given that JavaScript identifiers are unicode, you can try fancy things like for example:
(function (Ω) {
Ω("#whatever").css(....)
})(jQuery);
dont use *
as a variable name please choose valid name here i choose js
var js =jQuery.noConflict(); //by this you can do it
reference jQuery.noConflict()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With