Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  5] [ 1]  / answers: 1 / hits: 9081  / 10 Years ago, wed, february 4, 2015, 12:00:00

I have some JS code that tried to append the JS file into header, but I have an error message on chrome Uncaught ReferenceError: Invalid left-hand side in assignment and get different error on safari SyntaxError: Unexpected token ';'. Expected ']' to end a subscript expression., my code



var js =  $('<script />',
{
src : 'scripts/contentStrings/content.js',
type : 'text/javascript',
language : 'javascript'
})

js.appendTo(head) <-- the error from


If I check on header the script is append to header.



Any help is much appreciated.



Edited :



Here is the inside of content.js



var sponsor = {}

sponsor[containerSize] = [[78,60] , 60 , [7,17.3] , [19,16]];


sponsor[imageBackground] = [[78,60] , 60 , [7,17.3] , [19,16]];


sponsor[contentLong] = <div id='contentGroup'>Long content</div>;

sponsor[contentShort] = <article style='font-size:10px !important'>Some short article</article>;

More From » jquery

 Answers
3

A quick spot:




sponsor[contentLong] 



is missing the closing bracket.


[#39519] Monday, February 2, 2015, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kinsleyashlynnh

Total Points: 64
Total Questions: 119
Total Answers: 98

Location: Burundi
Member since Sat, Aug 21, 2021
3 Years ago
;