views:

24

answers:

2

Suppose I have a radio button collection. While I am selecting/deselecting certain options, Tick mark seems to be moving as well. However if I see the HTML code, none of the options really show a "checked=true" in html.

1)So where is this information stored about my choices really ? DOM objects ?

Also using JS I change the checked attributes of DOM object- yet I dont see a change in HTML source of page. & I want this information to be present in HTML - coz I would be exporting pages in a way.

2)How do I use the Javascript to include "checked=true" in HTML itself ?

+2  A: 

When you right click and select "view source", you will get the source that was sent to you by the server. Firefox has a "view selection source" that allows you to view the "updated" source, and the Firebug extension allows you to view this as well. Chrome has got "Developer Tools" built-in that allows you to inspect the HTML as well.

Daniel Egeberg
+3  A: 

The HTML source is only the "blueprint" for the current page. The code gets loaded and parsed into DOM nodes, somewhere in the browser's memory. When the page is displayed, things take place in the browser's memory.

Therefore, dynamic changes will not automatically reflect to the default "view source" view in the browser.

Firebug's source view can show dynamic changes to the DOM - it translates them back into HTML "live". You won't see form values there, though.

As @Daniel points out, the "view selection source" function in Firefox also shows a "live" view of the selected area.

Pekka