开发者

jQuery/Javascript pulling html/innerHTML

<div id="test">
    <img align="right" src="images/home-faqs.jpg" alt="FAQS" wi开发者_Python百科dth="428" />
</div>

So I pull #test innerHTML but the result is

<img align="right" src="images/home-faqs.jpg" alt="FAQS" width="428">

it removes the closing slashes, how do I get javascript not to do that?


That is mostly an artifact of the browser and the library. You won't be able to stop that if you are using an an HTML doctype, but it isn't important. The XML-style closing slash is actually not part of the HTML standard. When you're in an XML doctype, javascript will keep the slashes.

Validation only applies to the page as it loads before javascript changes the DOM, so no worries on that front, either.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜