By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,481 Members | 1,713 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,481 IT Pros & Developers. It's quick & easy.

How to remove items of a select field

P: n/a
Hi all;
i'm adding items to a select list like this:

var insertPoint = inst.getElementsByTagName("itemlist").item(0);
var itemCount = insertPoint.getElementsByTagName("item").length;
for(x=0;x<found.length;x++)
{
alert(found[x])
var item = document.createElementNS("", "item")
item.appendChild(document.createTextNode(found[x]))
insertPoint.appendChild(item)
}

Now if i want to delete all items of this select list how to do it?
thanks for your help

Sep 19 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

sniper wrote:
Hi all;
i'm adding items to a select list like this:

var insertPoint = inst.getElementsByTagName("itemlist").item(0);
var itemCount = insertPoint.getElementsByTagName("item").length;
for(x=0;x<found.length;x++)
{
alert(found[x])
var item = document.createElementNS("", "item")
item.appendChild(document.createTextNode(found[x]))
insertPoint.appendChild(item)
}

Now if i want to delete all items of this select list how to do it?
thanks for your help
The code to work with here is a bit sparce but, I'll have a go at it
anyway. (BTW, is this xforms?)
var insertPoint = inst.getElementsByTagName("itemlist").item(0);
var items = insertPoint.getElementsByTagName("item");
for( i=0; i<items.length; i++)
{
insertPoint.removeChild(items[i]);
}

ref: http://developer.mozilla.org/en/docs...nt.removeChild

Sep 19 '06 #2

P: n/a
Hi Paul;
Thanks for your help, that's what i'm looking for.
yes it's XFORMS.
Tanks
ref: http://developer.mozilla.org/en/docs...nt.removeChild
Sep 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.