Re: Change the same span element all the time
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Change the same span element all the time

From: Ronaldo Junior <setembro@gmail.com>
Date: Fri Apr 28 2006 - 21:06:19 CEST

Ronaldo Junior wrote:
> You don't need to replace the entire element to chance its text. Use
> the innerText property to modify it:
>
> var newSpan = document.createElement("FirstNameLengthLabel");
> newSpan.innerText = "New label text";

Oops, I copied the wrong part of your code, sorry.

var spanElm = document.getElementById("FirstNameLengthLabel");
spanElm.innerText = "New label text";
Received on Mon May 1 05:26:04 2006