javascript - String cannot be parsed to HTML -
i have weird problem php , javascript files. have html content in database, , want insert page. so, values , pass html page this:
$string = preg_replace( "/\r|\n/", "", htmlentities($formcontent) ); i string can use pass javascript, this:
var contentform = '<?php echo $string; ?>'; now want insert html page. i've got div set up, if insert it, keeps getting treated string there isn't dom display.
var htmltrimmed = $.trim(contentform); var htmlcontent = $.parsehtml(htmltrimmed); console.log(htmltrimmed); $('#currentform').html(htmltrimmed); but when check console of check actual div, there plain string inserted.:

you see gets treated string. don't understand why it's acting this.
edit:
this contentform value, i've cut of off, because string long, actual value valid html string!:
<form class="form-horizontal" ><fieldset><!-- form name --><legend>dmn sgt</legend><!-- multiple radios --><div class="control-group"> <label class="control-label" for="multipleradios-0">grund der messebesuch</label> <div class="controls"> <label class="radio" for="multipleradios-0-0"> <input type="radio" name="multipleradios-0" id="multipleradios-0-0" value="konkretes interesse produkt" checked="checked">
use $.parsehtml example
see example: http://jsfiddle.net/kevalbhatt18/lny2m0kc/1/
var t = $.parsehtml('<form class="form-horizontal" ><fieldset><!-- form name --><legend>dmn sgt</legend><!-- multiple radios --><div class="control-group"> <label class="control-label" for="multipleradios-0">grund der messebesuch</label> <div class="controls"> <label class="radio" for="multipleradios-0-0"> <input type="radio" name="multipleradios-0" id="multipleradios-0-0" value="konkretes interesse produkt" checked="checked">') console.log(t); $('#test').html(t[0].data)
Comments
Post a Comment