0

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>
Deep Kakkar
  • 5,831
  • 4
  • 39
  • 75
Michael Slze
  • 1
  • 1
  • 1

1 Answers1

0

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.

Antonio
  • 851
  • 2
  • 8
  • 17