well i just found
document.getElementById('myItemId').parentNode.removeChild(document.getElementById('myItemId));
that's a wired logic...
maiko
hi,
i am wondering what the quickest way is to get a node
reference out of an element accessed by
.getElementById(), let's say i want handle myItem
Hi maiko,
JavaScript isn't a strongly typed language, so you don't have to cast or
anything like that. You just use the interface you need:
var myItem = document.getElementById('myItemId');
myItem.removeChild(...);
-Jonathan
On 10/17/05, osaka minami [EMAIL PROTECTED] wrote:
hi,
i am
On 10/17/05, osaka minami [EMAIL PROTECTED] wrote:
well i just found
document.getElementById('myItemId').parentNode.removeChild(
document.getElementById('myItemId));
Ah, I see. I hadn't understood it was the parent node you wanted.
that's a wired logic...
maiko
hi,
i am wondering
Hi, Maiko-
If you're looking for the most optimized way, do it like this:
var myItem = doc.getElementById('myItem');
myItem.parentNode.removeChild(myItem);
That way, you're only hitting the DOM to find the element once, instead of
twice. gEBI is a rather expensive method call, I would think,
At 08:24 AM 10/17/2005, Doug wrote:
That way, you're only hitting the DOM to find the element once, instead of
twice. gEBI is a rather expensive method call, I would think, especially on
large documents (unless the implementation caches a hash table of all the
ids).
Interesting -- I would take
On 10/17/05, david dailey [EMAIL PROTECTED] wrote:
At 08:24 AM 10/17/2005, Doug wrote:
That way, you're only hitting the DOM to find the element once, instead
of
twice. gEBI is a rather expensive method call, I would think, especially
on
large documents (unless the implementation caches a
Hi, David-
| At 08:24 AM 10/17/2005, Doug wrote:
| That way, you're only hitting the DOM to find the element
| once, instead
| of twice. gEBI is a rather expensive method call, I would think,
| especially on large documents (unless the implementation
| caches a hash
| table of all the ids).
Mozilla maintains a hash table. I'd imagine most other browsers would do the
same, but I could be wrong.
Agreed. Another important point is this: because all of the
implementations do silly stuff like maintain a hash table you can get
into trouble with IDs. Supposedly the DTD has to be in
8 matches
Mail list logo