I am trying to remove an attribute from a node. I use the Dojo/Dijit bundled with Spring Roo. I am at a loss on how to sort the error below. Can anyone please help?
Here is the js code:
dojo.ready(function remAttr(){
dojo.removeAttr('theId', 'value');
});
Here is the node I am trying to access:
<option id="theId" value="">Tous</option>
Here is the error code I get:
byId(node) is null
toString()dojo.js (ligne 14)
node = "theId"
name = "value"
remAttr()findPl...ld&form (ligne 40)
toString()dojo.js (ligne 14)
toString()dojo.js (ligne 14)
toString()dojo.js (ligne 14)
toString()dojo.js (ligne 14)
e = DOMContentLoaded
I just tried this (jsfiddle) and it seems to work fine. The error you have suggests that the 'theId' node can't actually be found in the DOM tree (byId(node) is null). Are you sure it's actually present? If you do a document.getElementByID("theId") by hand, can you find the option node yourself?
Whenever I've seen this sort of behaviour before, it was generally that the part of the UI I was looking for hadn't yet been rendered.