开发者

display new lines from xml to html using jquery

I want to display the data from xml to html via jquery

I have the data in xml in paragraph format, but becuase of html's default behaviour it cannot display the lines which are in form of "enter".

please suggest how can i make 开发者_JAVA百科sure that it'll start displaying.

my query is very similar to this link which is already done here.

but i don't know how to do it in html/javascript

Read xml string into textbox with newline

Thanks in advance

Dave


If you're inserting indented XML code, you can use the white-space: pre CSS property on the container to display the line breaks:

<p style="white-space: pre" id="xmlCode"></p>

And in jQuery just set the text:

$('#xmlCode').text(xmlContent);


I just inserted the iwantenter into the xml file whereever I need enter

and after assigning the text to the div

I called this function

id_of_my_div.replace(/iwantenter/g,'< br > < br >'); and it worked

Thanks Krof for continues replies.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜