jQuery .html(), .append() doesn't work on multiline markup -
i have trying .html() or .append() function render markup returned third party plugin via ajax call.
the ajax response (which coming fine) looks like:
<div> <!-- start third party markup --> <div> <img id="img1" usemap="#dnc_map_43" src="charts/solution_id_6/dnc-vvvgdwwl.png?634336319915542170" style="height:294px;width:628px;border-width:0px;" /> <map name="dnc_map_43" id="map1"> <area shape="poly" coords="0,274,628,274,628,294,0,294" href="http://www.dotnetcharting.com" alt="visit .netcharting licensing options , more information." title="visit .netcharting licensing options , more information." /> <area shape="poly" coords="381,26,616,26,616,56,381,56" href="http://www.dotnetcharting.com" alt="visit .netcharting licensing options , more information." title="visit .netcharting licensing options , more information." /> </map> </div> <!-- end third party markup --> </div>
however have no control on way markup third party formatted , have discovered (after tearing hair out morning) .html() or .append() jquery functions require markup in either 1 line or escaped using "\" after each new line character.
does know way around this?
if indeed true (although can hardly imagine is), can use replace
method replace \n
, \r
an empty string space.
Comments
Post a Comment