clearing contents of a div

Discussion in 'HTML' started by richard, Mar 3, 2009.

  1. richard

    richard Guest

    I need a way of clearing the current contents of a div.
    Let's say the current content is "alpha list" and I want to replace it
    with "beta list".
    Of course the content wil be much more than this like including a list
    box thingy.

    Even if it means using a little javascript is not a big deal.
    richard, Mar 3, 2009
    #1
    1. Advertising

  2. richard

    rf Guest

    richard wrote:
    > I need a way of clearing the current contents of a div.
    > Let's say the current content is "alpha list" and I want to replace it
    > with "beta list".
    > Of course the content wil be much more than this like including a list
    > box thingy.
    >
    > Even if it means using a little javascript is not a big deal.


    How else would you do it?

    innerHTML
    rf, Mar 3, 2009
    #2
    1. Advertising

  3. richard

    dorayme Guest

    In article <>,
    richard <> wrote:

    > I need a way of clearing the current contents of a div.
    > Let's say the current content is "alpha list" and I want to replace it
    > with "beta list".
    > Of course the content wil be much more than this like including a list
    > box thingy.


    My my, you sure have an elegant way of asking a tight little question!

    I can hear rf coming along to say, rather succinctly and understandably,
    to you: wtf...

    --
    dorayme
    dorayme, Mar 4, 2009
    #3
  4. richard

    asdf Guest

    "dorayme" <> wrote in message
    news:...
    > In article <>,
    > richard <> wrote:
    >
    >> I need a way of clearing the current contents of a div.
    >> Let's say the current content is "alpha list" and I want to replace it
    >> with "beta list".
    >> Of course the content wil be much more than this like including a list
    >> box thingy.

    >
    > My my, you sure have an elegant way of asking a tight little question!
    >
    > I can hear rf coming along to say, rather succinctly and understandably,
    > to you: wtf...
    >
    > --
    > dorayme


    ....or more usefully (and seeing as you said you weren't averse to a little
    javascript) try...

    document.getElementById("mydiv").innerHTML = "";

    You didn't say where the listbox markup would come from, so I'll assume you
    are doing something serverside. You may have to 'seed' your javascript with
    a variable containing the 'beta list'... something like (assuming PHP, for
    instance):

    document.getElementByID("mydiv").innerHTML = "<?php echo $betalist ?>";

    Give it a try. I didn't say I'd tested it.
    asdf, Mar 4, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. itsme

    Clearing session object contents

    itsme, Oct 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,579
    Steve C. Orr [MVP, MCSD]
    Oct 16, 2003
  2. Some One
    Replies:
    5
    Views:
    798
    Toby A Inkster
    Aug 9, 2003
  3. news.eircom.net

    clearing contents of ostringstream object

    news.eircom.net, Jul 1, 2005, in forum: C++
    Replies:
    4
    Views:
    476
    Maxim Yegorushkin
    Jul 4, 2005
  4. Terry Michaels
    Replies:
    0
    Views:
    115
    Terry Michaels
    Aug 28, 2010
  5. Replies:
    2
    Views:
    197
Loading...

Share This Page