acess the type of input in dojo
-
06-07-2021 - |
Domanda
i enter dojo.query('input') i get the following :-
<input id="paragraphtwo" data-dojo-type="dijit/form/SimpleTextarea" rows="4" cols="50" style="width:auto">
now WHEN i write
text= dojo.query('input')
[<input id="paragraphtwo" data-dojo-type="dijit/form/SimpleTextarea" rows="4" cols="50" style="width:auto">]
gets storeed in text.
now when i write text[0].id i get "paragraphtwo". how can i access the type of input i.e hwo can i get "dijit/form/SimpleTextarea" just like i got the id
Soluzione
One way to this is as follows:
var input = dojo.byId("paragraphtwo");
var dojoType = dojo.attr(input, "data-dojo-type"));
console.log(dojoType); // Outputs: dijit/form/SimpleTextarea
Altri suggerimenti
Using the declaredClass
property:
console.log(dijit.byId("paragraphtwo").declaredClass);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow