Adding lazyload class inside a script
-
I had a script with this line in it:
jQuery('#logo a').append('<img src="'+get_logo_image_src()+'" alt="Personal Growth Web" />');The plugin changed it to:
jQuery('#logo a').append('<img src="'+get_logo_image_src()+'" alt="Personal Growth Web" data-src="'+get_logo_image_src()+" class="lazyload" /><noscript><img src="'+get_logo_image_src()+'" alt="Personal Growth Web" /></noscript>');Which resulted in “Uncaught SyntaxError: missing ) after argument list” error in the browser console.
Looks like the plugin is (somewhat blindly) targeting the string “<img” and inserting the class incorrectly.
I’ve changed this line into this, and the problem was gone:
jQuery('#logo a').append('<' + 'img src="'+get_logo_image_src()+'" alt="Personal Growth Web" />');
The topic ‘Adding lazyload class inside a script’ is closed to new replies.