Here is a jsFiddle demo of my problem.
This jquery snippet adds 3 divs once a click event is fired. However, the console says "Uncaught Syntax Error : Unexpected token < ".
script
$('#e16').on('click', function(){
$(this).append("<div id='e17' class='kim2bb'>Alcohol 0.2+</div>
<div id='e18' class='kim2bb'>Alcohol 1.0~2.0</div>
<div id='e19' class='kim2bb'>Alcohol 0.05~1.0</div>");
});
html
<div id="e16" class="kim2bb">Drunken Drive</div>
You have a string broken over multiple lines:
$(this).append("<div id='e17' class='kim2bb'>Alcohol 0.2+</div>" +
"<div id='e18' class='kim2bb'>Alcohol 1.0~2.0</div>" +
"<div id='e19' class='kim2bb'>Alcohol 0.05~1.0</div>");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With