Ree
Ree

Reputation: 6211

Deleting properties of DOM elements

Is there a way to delete properties of DOM elements? I'm using a widget that upon rendering itself adds tabindex attributes to certain nodes. I'd like to remove them because they cause unwanted visual changes.

I tried the following which does not seem to have any effect (tabindex stays the same):

delete domNode.tabIndex;
domNode.tabIndex = undefined;

Upvotes: 1

Views: 212

Answers (1)

KooiInc
KooiInc

Reputation: 122906

As I recall, you can use the removeAttribute method. So, in your case:

[DomElement].removeAttribute('tabindex');

should do the trick.

Upvotes: 1

Related Questions