I'm working against a legacy system which produce self-closing div when the div contains nothing.
I want use jQuery to get inner html of some div, but if the div is self-closing, jQuery always get wrong html.
See the demo code bellow:
<!doctype html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="application/javascript">
$(function () {
var s = $('.b').html();
alert(s);
});
</script>
</head>
<body>
<div class="a"></div>
<div class="b" />
<div class="c">This is c</div>
</html>
When I run this code, I get this result:
Please help me, any suggestions would be appreciated.