W3C home > Mailing lists > Public > www-talk@w3.org > May to June 2007

JavaScript (E4X) - Deleting a target element per id

From: Frederick C. Lee <fclee@highstream.net>
Date: Wed, 16 May 2007 10:38:31 -0600
To: www-talk@w3.org
Message-Id: <D269D5F5-9132-4FBE-B054-20316F01E498@highstream.net>
Environment:  Mozilla/Firefox 2.0; JavaScript 1.7
My Machine: MacBook Pro running OS X (10.4.9)

	My apology if this is the wrong forum.
	I've been searching for a way to allow the user to delete a specific  
xml element/node/property given its ID.

For example:

var pt =
    <periodictable id="0" name="mytable">
         <project id="1" name="myproject"/>
         <information id="2" name="myInfo"/>
	        <element id="3" type="gas">
                        <name id='4'>Helium</name>
		<element id="5" type="solid">
                        <name id="6">Lithium</name>

Normally you could delete the element 'Helium' like this:


However, I want to be able to dynamically delete a node (element) per  

var myID = '3';
delete pt..*.(function::attribute("id")==myID);

But this doesn't work.

Question: How can I dynamically delete an element given its id?

I can't find any info on the internet.


Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

Received on Wednesday, 16 May 2007 16:41:17 UTC

This archive was generated by hypermail 2.4.0 : Monday, 20 January 2020 16:08:29 UTC