Home >Web Front-end >JS Tutorial >Solution to the $ conflict between jquery and velocity variables in html files_jquery

Solution to the $ conflict between jquery and velocity variables in html files_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 17:18:062094browse
Problem description:

When using jquery in an environment using velocity template engine, such as: $.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds /sfzc1@realintelligence.com/public/basic')

where $ conflicts with $ in the velocity variable.

Solution:

Define a velocity variable: #set($jquery="$.") Then: ${jquery}fullCalendar.gcalFeed('http: //www.google.com/calendar/feeds/sfzc1@realintelligence.com/public/basic'), using the replacement principle of the veloctiry template engine, the html code is compiled for the first time into $.fullCalendar.gcalFeed('http:// www.google.com/calendar/feeds/sfzc1@realintelligence.com/public/basic'), after being replaced, it was compiled twice and there was no problem with the code.

To sum up, the above answers a truth: "To untie a bell, one needs to tie it."
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn