i trying exact html content of div.
when using html() function jquery, result not match actual content.
please check fiddle , click on black square:
the code:
<div id="mydiv" style="width:100px; height: 100px; background-color:#000000; cursor:pointer;"> <div id="inside" style="background-color:#ffffff; border-style:none;"></div> </div> $('#mydiv').click(function() { alert($(this).html()); });
jquery change color rgb format , remove border-style attribute.
how can solve problem?
the browser consumes html, generates dom, discards html. innerhtml
(which .html()
hits) gives serialisation of dom html.
if want raw html, you'll need use xmlhttprequest
fetch source code of current url , process yourself.
Comments
Post a Comment