I’m trying to check whether an html element with a certain id exists before doing some operations on that.
How can I check whether an id exists or not with dojo?
I saw in javascript we can use try catch. But i like a more clean way.
edit:
Doing it like this:
var a = dojo.byId('myId');
if(a){
// something
}
In dojo, it’s just the same as plain javascript. You should do:
Hope this helps. Cheers