hello i,m a newbie i want replace in a webpage html code with other html code using innerHTML
this is what i’m tryng to do:
function changeText3()
{
var oldHTML=document.getElementById('esempio');
var newHTML = 'Nuovo codice html';
if (oldHTML==oldHTML)
{
document.getElementById('esempio').innerHTML = newHTML;
}
else
{
document.getElementById('esempio').innerHTML = oldHTML;
}
return false;
}
<div id='esempio'>Codice html</div>
<input type='button' onclick='changeText3()' value='Cambia Html'/>
This code work only at first click but i want that work also when i reclick
thanks