Skip to content Skip to sidebar Skip to footer

Appending A Div Containing An Image In A Function

Everything comes just to the following single line of code, which I probably mess up somewhere and after an hour with something of searching for error I still don't find it, so tha

Solution 1:

$("red").append("<div class=\"reddot\" style=\"top: "+ y + "px; left: "+ x +"px;\"><img src='red.png' height='10' width='10'></div>");

All the " should be escaped when in a string with " otherwise JS will assume the string has ended


Solution 2:

Try this one

$("red").append("<div class = 'reddot' style = 'top: "+ y + "px; left: "+ x +"px;'><img src='red.png' height='10' width='10'></div>");

Post a Comment for "Appending A Div Containing An Image In A Function"