Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I keep on getting an error message in the chrome console saying that there is an uncaught syntax error. Anybody has any solutions? I am a beginner with JQuery
jQuery(function($) {'use strict',
//#main-slider
$(function(){
$('#main-slider.carousel').carousel({
interval: 8000
});
});
You have two errors:
The comma (,) after 'use strict' should be a semicolon (;).
You need a closing }); to match the outermost call to jQuery.
Just do:
//#main-slider
$(function(){
$('#main-slider.carousel').carousel({
interval: 8000
});
});
You don't need the other stuff like the JQuery(), from my understanding it's essentially the same as doing $(function(){})
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
My code in javascript causes an error at the following line:
var tries:int=GetCallAttemptCount();
The error message says Error in Script Unexpected token : , Line 3
Line 3 is where the error appears. The script was originally in jquery, so I wonder is there a difference in how a variable is declared in Javascript and Jquery?
I'm computer literate, but I am a beginner with Javascript.
Thanks all, Adam
That's not javascript, this looks like typescript, in JS:
var tries = GetCallAttemptCount();
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
When I run this IIFE function in the console or using it in document, it doesn't work, per definition it's immediately invoked, so why it's not showing anything on the console?
(function(){
console.log(8);
});
You missed the execution part.
(function(){
console.log(8);
})(); // () needs to be added
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I need to add class to all the links that have "href=login". And i tried to use this javascript
jQuery(document).ready(function($){
$(.pageWidth).find('a[href*="/login/"]').addClass('OverlayTrigger');})
Unfortunately, i tried so many times and it always getting this error
Uncaught Syntax Error: Unexpected token
How can i fix this? What's the problem here?
Thank you!
You are missing quotes in your jQuery selector:
jQuery(document).ready( function($) {
$('.pageWidth').find('a[href*="/login/"]').addClass('OverlayTrigger');
} )
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have the following syntax:
And am receiving the following error on line 6:
Uncaught SyntaxError: Unexpected token {
I read the api docs on done() and I can't see what I am doing wrong here.
$.post(path).done(funtion(data) { ....
^----notice any missing characters here, a "c" perhaps?
JS is trying to call a function called "funtion", which means that the { afterwards is illegal syntax. Since it parses out that syntax error first, it doesn't get to the point of being to able to tell you that "funtion" doesn't exist.
You wrote funtion instead of function.
$.post(path).done(function(data) { console.log(data) });
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
The following keeps throwing out an Uncaught SyntaxError: Unexpected token { and I can't see what's wrong with it??
$(window).resize(function(){
if ($("a.burger-menu").is(":hidden") {
$("nav a").show();
}
});
Can anyone help?
Many Thanks
You have not closed the if() condition.Try this:
$(window).resize(function(){
if ($("a.burger-menu").is(":hidden")) {
$("nav a").show(); // ^ That was missing.
}
});