Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > clearing contents of a div

Reply
Thread Tools

clearing contents of a div

 
 
richard
Guest
Posts: n/a
 
      03-03-2009
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.

 
Reply With Quote
 
 
 
 
rf
Guest
Posts: n/a
 
      03-03-2009
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


 
Reply With Quote
 
 
 
 
dorayme
Guest
Posts: n/a
 
      03-04-2009
In article <(E-Mail Removed)>,
richard <(E-Mail Removed)> 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
 
Reply With Quote
 
asdf
Guest
Posts: n/a
 
      03-04-2009

"dorayme" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In article <(E-Mail Removed)>,
> richard <(E-Mail Removed)> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
<div ... /> and <div ...></div> K Viltersten ASP .Net 4 03-31-2009 07:33 PM
possible viewport question, need to control what portion of div contents appear when overflow:auto and too much content in div Jake Barnes Javascript 1 09-05-2007 11:00 PM
NS/FF don't change div offsetWidth when div innerHTML is added toand div becomes wider mscir Javascript 3 06-26-2005 04:04 PM
Q: Div A inside Div B is larger than Div B Dwayne Madsen Javascript 1 06-01-2005 03:02 PM
Creating a CSS class to use in DIV to affect all contents of the DIV??? Some One HTML 5 08-09-2003 03:12 PM



Advertisments