javascript innerhtml não altera o conteúdo no código fonte
Não sei como resolver isso. Quero alterar o código-fonte (DOM) em algum evento, como este:
roteiro
<script type="text/javascript">
function ChangeText(){
document.getElementById("p1").innerHTML="New text!";
}
</script>
html:
<p id="p1">Hello world!</p>
<input type="button" onclick="ChangeText()" value="Change text" />
bem, isso funciona bem quando clico no botão. mas quando visualizo o código-fonte, ele ainda se parece com o seguinte:
<html>
<body>
<p id="p1">Hello world!</p>
<input type="button" onclick="ChangeText()" value="Change text" />
</body>
</html>
ao invés de
<html>
<body>
<p id="p1">New text!</p>
<input type="button" onclick="ChangeText()" value="Change text" />
</body>
</html>