clearing contents of a div

R

richard

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.
 
R

rf

richard said:
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
 
D

dorayme

richard said:
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...
 
A

asdf

dorayme said:
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...

....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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top