Link to home
Start Free TrialLog in
Avatar of MOSTAGHASSI
MOSTAGHASSIFlag for United States of America

asked on

Syntax error in this jQuery codes

Hello;

I have the codes below but get error in lines  12  and  23

jQuery(function($) {
"use strict";
    //this part is for open mobile menu on tablet and mobile
    $(".mobile-menu-icon a").click(function(evt) {
         evt.preventDefault();
         if($(".google_search_mobile").is(":visible")) {
              $(".google_search_mobile").toggle("fast", function() {
                    $(".wrapper-mobile-menu").toggle("slow");
              });
         }
         else
             $(".wrapper-mobile-menu").toggle("slow");
    });
    //this part is for open google searchbox on tablet and mobile
    $(".mobile-search-icon a").click(function(evt) {
         evt.preventDefault();
         if( $(".wrapper-mobile-menu").is(":visible")) {
               $(".wrapper-mobile-menu").toggle("fast", function() {
                   $(".google_search_mobile").toggle("slow");
              });
         }
         else
             $(".google_search_mobile").toggle("slow");
    });
});

Open in new window


Thanks for your help
Avatar of ste5an
ste5an
Flag of Germany image

What error? And where do you get it?
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am not getting any errors with your code.
Avatar of MOSTAGHASSI

ASKER

Thanks Chris,it is ok now.
Would you please have a look on this question also:

"Back to top of page link does not animate with this jquery codes"
Please post the error message. Cause you normally don't need those brackets, e.g.

<!-- saved from url=(0016)http://localhost -->
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>Title</title>
		<script src="js/jquery-3.1.0.min.js" type="text/javascript"></script>
		<script>
			$(document).ready(function () {
				$('button').click(test);
			});
			
			var a = 1;
			var b = 1;
			function test() {
				"use strict";
				if ( a === b ) {
					$('div').text('==');
					b++;
				}
				else
					$('div').text('!=');
			}
		</script>
	</head>
	<body>	
		<div></div>
		<button>click me</button>
	</body>
</html>

Open in new window

@Author - Are you sure that the brackets solved your issue as it is not giving us any error.