Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2006
    Posts
    84

    Javascript to change text on an html page?

    Wondering if anyones got some simple code to update text on an html page after a javascript on click action?

  2. #2
    Join Date
    Dec 2002
    Location
    NY, NY
    Posts
    3,975
    Quote Originally Posted by housefire View Post
    Wondering if anyones got some simple code to update text on an html page after a javascript on click action?
    Assuming your text is in a div or something.. give it an id
    <div id="blah"> POOO </div>

    After the action just do

    document.getElementById("blah").innerHTML = "MEOW";

  3. #3
    Join Date
    Mar 2006
    Posts
    84
    And if I wanted to pull the value out of that text div to put into another field with js, any idea how id pull the value of it?

  4. #4
    Join Date
    Dec 2007
    Location
    Lebanon
    Posts
    413
    if you

    Code:
    <div id="blah"> POOO </div>
    <div id="bloh"> MEOW </div>
    
    document.getElementById("blah").innerHTML=
    document.getElementById("bloh").innerHTML
    this will put MEOW at the place of POOO

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •