I know how to use .html () to capture html inside my selected element, for example:
<div id="outside> <span>hello</span> </div>
using something like
var span = $('#outside).html();
will capture my range as html. My problem is that I have
<img id="image" src="image.png">
How can I assign html as a string to a variable? Using
var image = $('#image').html()
gives me an empty string.
var image = $('#image')[0]
appears to get the html that I want, but its actually still an object.
user883036
source share