I am trying to use the add function to add an HTML fragment to a div but I can’t get it to work. My code:
$('#curveContainer').add('<img src="http://upload.wikimedia.org/wikipedia/commons/f/f0/Blue-dot-5px.png" alt="test" />');
Fiddle here – http://jsfiddle.net/7a86g/4/
You want
append(), notadd().From the
add()documentation…append()will add the new content to the DOMFiddle here – http://jsfiddle.net/7a86g/5/
You can also use
html()to completely replace the contents of the matched element.