'netbeans error expected an operand but found
Beginner to java trying to implement jquery into netbeans by inputting these codes into a javascript file to create a main-menu page. Utilizing jquery v 3.1.1. They highlight my second script tag saying its an error
<script type="text/javascript" src="jquery.js"> </script>
var main = function () {
$('.icon-menu').click(function () {
$('.menu').animate({
left: "0px"
}, 200);
$('body').animate({
left: "285px"
}, 200);
});
$('.icon-close').click(function () {
$('.menu').animate({
left: "-285px"
}, 200);
$('body').animate({
left: "0px"
}, 200);
});
};
$(document).ready(main);/*
They highlight my as an error and give the message
Menu.js:2:8 Expected an operand but found <
<script type="text/javascript" src="jquery.js"> </script>
Solution 1:[1]
you should put the javascript code inside of the xml tag ():
<script type="text/javascript" src="jquery.js">
var main = function () {
$('.icon-menu').click(function () {
$('.menu').animate({
left: "0px"
}, 200);
$('body').animate({
left: "285px"
}, 200);
});
$('.icon-close').click(function () {
$('.menu').animate({
left: "-285px"
}, 200);
$('body').animate({
left: "0px"
}, 200);
});
};
$(document).ready(main);
</script>
Also, you have an open coment "/*" at the end of your code.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
