so i've been trying to change the text in a div.
<div id="company">
<div id="companyname">some name</div>
</div>
I thought a simple:
document.getElementById("companyname").innerText = "Company";
Would work, but no. Help would be appreciated.
so i've been trying to change the text in a div.
<div id="company">
<div id="companyname">some name</div>
</div>
I thought a simple:
document.getElementById("companyname").innerText = "Company";
Would work, but no. Help would be appreciated.
Make sure you are appending content when Document is loaded completely.
Try to put it in :
window.onload = function() { document.getElementById("companyname").innerText = "Company"; };
Or Using jQuery:
$(document).ready(function() {
$('#companyname').html('company');
};
document.getElementById("companyname").innerHTML = 'teste';
<html>
<body>
<head>
</head>
<div id="companyname"><div>
</body>
</html>