Consider this for example:
<div>
A&
<br>
B
</div>
If I use $('div').html()
, it returns A&<br>B
. It converts A&
into A&
which I do not want.
If use use $('div').text()
, it returns A&B
. It ignores the <br>
which I do not want either.
I'm looking for a way to get all the html inside the div without parsing it and without skipping over the tags like <br>
either.
This is the result I want: A&<br>B
. How do I achieve that?