How to resolve conflicts between jquery and NVelocity _ jquery
Source: Internet
Author: User
Sometimes jquery conflicts with NVelocity. The following is a specific solution. For more information, see. When the $ of NVelocity conflicts with the $ of Jquery, the following solutions are provided:
1,
Use jQuery. noConflict. For example, var j = jQuery. noConflict (); j. ajax ();
Disadvantage: When jQuery plug-ins are used, the plug-ins will become invalid!
2,
Use jQuery instead of $. For example: jQuery. ajax ();
Disadvantage: it is not suitable for expansion. If it is replaced with a third-party library, it will be difficult.
3,
The conflict method in wrap jQuery.
For example, if $. ajax () Conflicts in Velocity, the definition is as follows:
Function dw (){}
Dw. ajax = function (s) {jQuery. ajax (s) ;}dw. ajax ();
4,
Define a $ JQ as $. You can use $ {JQ} AJAX in js later.
Write (defined) in the foreground as follows: # set ($ JQ = "$ .")
I recommend 4th methods.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service