<div id="price">bla</div>
I need to set a value inside that DIV tag using Javascript, how would I do it?
Doesn't work for me:
[quote:c6b5f693a5]Warning: Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
Source File: http://hosting.com/vps-order.html
Line: 19[/quote:c6b5f693a5]
[code:1:c6b5f693a5]
<script type="text/javascript">
function WriteDIVText()
{
document.getElementById("DIVText").innerText =
"Here is replacement text for the division.";
}
</script>
<div id="DIVText" style="border:ridge 3px; padding:5px">
Here is a division containing text.
</div>
<input type="button" value="Write to DIV" onclick="WriteDIVText()"/>[/code:1:c6b5f693a5]
use "innerHTML" instead and it will work
[code:1:13693b649f]
document.getElementById("displaytheprice").innerHTML = "wheeeeeeeeeeeeeeeeee";[/code:1:13693b649f]
javasscript, tagjavasscript, div, quot, bla, javascript, doesn, element, referenced, global, scope, getelementbyid, http, hosting, vps, html, text, writedivtext, divtext, innertext, replacement, px, padding, containing, input, onclick, innerhtml, displaytheprice, wheeeeeeeeeeeeeeeeee,