I'm getting an "unexpected token =" on the function toggleNav = function(evt){ line of the code sample below. I've went through a number of similar posts, but can't seem to see why it's throwing the error.
Any help pointing me in the right direction is much appreciated.
<script type="text/javascript"> $(document).ready(function($) { $("#nav > li > a").on("click", toggleNav); function toggleNav = function(evt){ var clicked = $(this).parent().attr("class"); $("#nav").removeClass("btn1 btn2 btn3 btn4 btn5 btn6 btn7").addClass(clicked); evt.preventDefault(); } }); </script>
var x = 1notint x = 1.