?
Solved

Javascript Syntax Error

Posted on 2014-08-13
2
Medium Priority
?
267 Views
Last Modified: 2014-08-13
FireFox Fire bug is saying a I have a Syntax Error on line 6.  I don't understand.
<script type="text/javascript">
jQuery(document).ready(function($) {
    $("#menu-menu-2").hide();
    $(".mtoggle").click(function() {
        $("#menu-menu-2").slideToggle(500);
    });
});
</script>	

Open in new window

0
Comment
Question by:rgranlund
2 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 40258845
Please try it like this.  Also, when you have a question about jQuery, it's helpful if you also post the associated HTML and CSS so we can test a complete implementation instead of having to guess about what the other 2/3 of the application might contain.

<script type="text/javascript">
$(document).ready(function() {
    $("#menu-menu-2").hide();
    $(".mtoggle").click(function() {
        $("#menu-menu-2").slideToggle(500);
    });
});
</script>

Open in new window

0
 
LVL 58

Expert Comment

by:Gary
ID: 40258886
Are you using Wordpress?
Is there a live link - there is nothing wrong with the code as it is
Is that the whole script? The error indicates you have other code and the functions are not closed properly.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month16 days, 22 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question