jQuery的DOM变化没有出现在查看源代码 [英] jQuery DOM changes not appearing in view source

查看:102
本文介绍了jQuery的DOM变化没有出现在查看源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这里有一个简单的问题。我知道用jQuery可以动态地做的东西像

I have a simple question here. I know with jQuery you can dynamically append HTML elements in the DOM by doing stuff like

$('').append('<p>Test</p>');

但我的问题是,为什么不把这些元素其实在视觉上的code出现(当你查看源代码在浏览器为例)。

But my question is, why don't these elements actually appear visually in the code (when you View Source in your browser for example).

请专家,让我知道为什么。谢谢

Please experts, let me know why. Thanks

推荐答案

最初的来源不会发生变化。只有DOM变化。

The original source never changes. Only the DOM changes.

您可以看到使用浏览器的开发者工具DOM的HTML可视化变化。

You can see an HTML visualization of DOM changes using your browser's developer tools.

您应该知道,当你操作DOM,你永远操纵HTML。由开发工具提供的HTML可视化是一个的间pretation 的DOM中的当前状态。有HTML标记没有实际的修改。

You should be aware that when you manipulate the DOM, you're never manipulating HTML. The HTML visualization offered by the developer tools is an interpretation of the current state of the DOM. There's no actual modification of HTML markup.

这篇关于jQuery的DOM变化没有出现在查看源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆