Home  >  Article  >  Web Front-end  >  Reasons and solutions why jQuery is valid in html but invalid in jsp_jquery

Reasons and solutions why jQuery is valid in html but invalid in jsp_jquery

WBOY
WBOYOriginal
2016-05-16 17:27:051310browse

Recently, I used jQuery to write the left and right movement of the option value of the drop-down box. The code is as follows:

Copy the code The code is as follows:




Untitled Document











< img id="add" src='../img/content/arrowRight_disabled.gif' width="24" height="24" border='0' style="cursor:pointer; vertical-align:middle;" / >
Add all to the right>>







<



< ;/body>


It can be used when browsing with this file, but it cannot be used when placed in jsp. The stupid way to solve it is to write an alert method to see what error is reported, and I found the problem:
The $ in front of jQuery’s function conflicts with the $ in JSTL of the JSP page, which directly leads to the inability to recognize the object method.
Solution:
Change all $ in the jQuery code to jQuery and it will work normally!
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