Click here to Skip to main content
15,916,846 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

In my Inspect Element i can get my result which is after fired an event. But when i click view page source i can't get my result.

How can i get the value?

Thanks,
Guna

What I have tried:

I tried javascript document.getElementbyId(tagname). But its not fetching the actual record.
Posted
Updated 4-Jun-16 4:05am

1 solution

It's not tag name. The argument of document.getElementbyId is the value of the element's attribute id; the value should be unique on page: document.getElementById() — Web APIs | MDN[^].

Тhis is how you can retrieve the present HTML (textual) representation of some HTML element:
Element.innerHTML — Web APIs | MDN[^].

The rest of the problem is unclear. What expect element? Why would you need the source of a Web page and what do you want to do with it?

Perhaps that you should understand that if you use JavaScript to modify the content of the page, you modify the actual HTML DOM and hence the rendered presentation of the page. You don't modify the source HTML code of the page. When the page is rendered for the first time, this original text is forgotten and cannot be used.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900