Results 1 to 3 of 3

Thread: [Resolved] Update <div> content

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    [Resolved] Update <div> content

    How can I change the text of a <div> tag after a button is clicked? I've got it to work in a text field, but can't seem to figure out anything with the <div>.

    I've tried .write, .innerHTML...no luck.
    Last edited by The Hobo; Dec 10th, 2002 at 07:13 PM.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Nevermind. I just used a <span> instead.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    It should work for a DIV too by the way:

    Code:
    <p onclick="document.getElementById('div').innerHTML='Hello Mr. Hobo';">Change text</p>
    <div id="div">Lalalalalala</div>

Posting Permissions

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



Click Here to Expand Forum to Full Width