Zeeshan Rang
Zeeshan Rang

Reputation: 19875

What's the equivalent of getElementsByTagName() in DOJO

What's the equivalent of getElementsByTagName() in DOJO?

eg:

<input id="inserviceInputId" type="text" value="09/05/2003" name="inserviceInput" style="width:7em">

So for this, I am trying to get the element via name="inserviceInput".

How can this be done?

Thanks in advance

Upvotes: 1

Views: 971

Answers (2)

Explosion Pills
Explosion Pills

Reputation: 191729

Seems to me to be the .query method, which ostensibly wraps document.querySelector or possibly Sizzle. You can use any attribute in the query including name. If you wanted to use getElementsByTagName you could always use that too since it's still available.

require(["dojo/query"], function(query){
  console.log(query("[name=inserviceInput]"));
});

Documentation

Upvotes: 4

jbabey
jbabey

Reputation: 46647

Dojo is a framework built on top of JavaScript, not a language. getElementsByTagName is a native JavaScript function.

So the Dojo equivalent of getElementsByTagName is ... getElementsByTagName.

Upvotes: 1

Related Questions