In front-end development, $ is a function in jQuery. If the parameters of $ are different, the functions implemented are different. During programming, $, as a symbol, may conflict with defined names in other files. So how do we handle this conflict? This article introduces two methods: 1. Solve the problem by releasing the right to use the $ symbol in the jQuery framework; 2. Solve using custom access symbols. Method 1: Releasing the right to use the $ symbol in the jQuery frameworkProcessing instructions: $ is just an alias of jquery. If you need to use another js library other than jquery, you can return control to the library by calling $.noConflict(). jQuery.noConflict(); jQuery(function () { alert("hellow") }); Note: The release operation must be written before writing other jQuery codes, and after the release, $ cannot be used, use jQuery instead. Method 2: Use custom access symbols to solveProcessing instructions: Customize a nj to replace the function of $ var nj =jQuery.noConflict(); nj(function(){ alert("hello inj custom access symbol") }); This is the end of this article on how to solve the jQuery conflict problem. For more information on how to deal with the jQuery conflict problem, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Nginx proxy forwarding implementation code uploaded by Alibaba Cloud OSS
>>: MySQL 5.7.10 winx64 installation and configuration method graphic tutorial (win10)
Previously, I summarized how to use CSS to achieve...
1. Check the character set 1. Check the MYSQL dat...
Features of MySQL: MySQL is a relational database...
Preface Sometimes file copies amount to a huge wa...
After reading the following article, you can depl...
1. Experimental description In the virtual machin...
Table of contents 1. Problem Description 2. Probl...
Table of contents Array destructuring assignment ...
Nginx Installation CentOS 6.x yum does not have n...
The establishment of MySQL index is very importan...
Table of contents Prepare Five weapons for…in Obj...
I will explain the installation of MySQL under Wi...
This article shares with you how to use Vue to ch...
Without further ado, let’s get started with resou...
As a lightweight open source database, MySQL is w...