For example, I use:
$('test-div').html("<div></div>")
Actually the html is changed, but when I click "view source" from the browser, in browser the html is not changed, is it a bug for the browser?
Thanks.
For example, I use:
$('test-div').html("<div></div>")
Actually the html is changed, but when I click "view source" from the browser, in browser the html is not changed, is it a bug for the browser?
Thanks.
View source pulls the results directly from the server and does not run any javascript.
Therefore your .html() call did not get run.
'View Source' always shows the HTML source of the file when it was downloaded originally. Updates via jQuery/Ajax will never show up there.
This is because this changes the HTML (actually the DOM) that is seen by the browser at runtime, not the actual source of the page.
Let's say for the sake of argument that using .html()
actually could change the actual source of the page, don't you think this might raise a security concern or two? Or three?
The answer is no, you cannot change the source of a web page from JavaScript without first tunneling through the server side via Ajax or other means.
View Source gives You the source of the page that was initial to all changes by jquery the dynamic changes are reflected in the generated source chk out the Web Developer plugin for firefox
Edit : https://addons.mozilla.org/en-US/firefox/addon/60/
view source > view Generated source
View source feature give you source in html who they obtained from server he not show you changes even if you update and modified the content using ajax or jquery
but you can also find out changes by plugin or add-ons like Firebug or Web Developer.
the source you see using View source not show you all changes who you made by jquery or ajax. he just show you content who they obtain from server.