www.webdeveloper.com
Results 1 to 2 of 2

Thread: Replace text in a div

  1. #1
    Join Date
    Mar 2006
    Posts
    32

    Replace text in a div

    I know how to replace text inside a given div:
    document.getElementById("containerID").innerHMTL = "some new text";

    But I want to change text depending on text that is in an array.

    So I have an array:

    my_array =
    {
    'Good' : 'Bad',
    'Happy' : 'Sad',
    }

    How can I change the text in a div with the key of the array? So if my div contains the word good I want to change it to bad.

  2. #2
    Join Date
    Mar 2006
    Posts
    32
    woops! wrong place! supposed to be in the javascript section.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles