MOSTAGHASSI
asked on
Syntax error in this jQuery codes
Hello;
I have the codes below but get error in lines 12 and 23
Thanks for your help
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");
});
});
Thanks for your help
What error? And where do you get it?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I am not getting any errors with your code.
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"
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>
@Author - Are you sure that the brackets solved your issue as it is not giving us any error.