Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

Unexpected identifier in this line of code

I'm new to JQuery and trying to get this example going

https://github.com/tuupola/jquery_lazyload#readme

I downloaded the jquery library, added class ="lazy". But now, I added this line of code
$("body").append("<script>$("img.lazy").lazyload();</script>"); 

Open in new window


to a .js code that's already in the project but it throws an error : unexpected identifier

not sure why.
init: function() {
				// register initializations here
				
				// quick view dialog div
				jQuery("<div/>").attr("id", "QuickViewDialog").html(" ").appendTo(document.body);
				
				// bonus product dialog div
				jQuery("<div/>").attr("id", "BonusProductDialog").html(" ").appendTo(document.body);
				
				
				$("body").append("<script>$("img.lazy").lazyload();</script>"); 
	
				// micicart object initialization
				this.minicart.init();
				
				// execute unobtrusive js code
				this.execUjs();

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany 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
Avatar of Camillia

ASKER

let me try. thanks for your help.