0

I am just trying to retrieve a text input element, but the pseudo selector 'first-of-type' seems not working. Ex:

//... requires dojo/query
var fields = query('input[type="text"]', form);// works well
var fields = query('input[type="text"]:first-of-type', form);// returns empty array :(

Then a another related question : what is the syntax to query the dom with multiple attr values : retrieve input with attr type = "text" AND attr name = "the-name" ?? Thank you for any help.

dmidz
  • 896
  • 7
  • 20
  • consider including the html that you're trying to select with that selector and what is first-of-type supposed to select. – Wern Ancheta Aug 10 '12 at 14:20

1 Answers1

0

I trying to reproduce your issue, and for me seems works fine. I suppose you are making a query to find a input inside to form. There is my code. I guess you are using 1.7.x

Check the code

Juan Picado
  • 1,823
  • 18
  • 33
  • thank you for the fiddle, so here is mine : [link](http://jsfiddle.net/qa4Z5/) , as you can see the pseudo first-of-type returns an empty array. The point is that I have one other node before my input text...so I am not understanding the use of this pseudo. I thought if I had many input text, I'll be able to retrieve the first one of that type. I just have to use fields[0]...In fact I made a confusion with attribute 'type' and 'first-of-type' tag type... – dmidz Aug 11 '12 at 11:48
  • I think the problem is pseudo class not allow attributes About Pseudo-classes [http://htmlhelp.com/reference/css/structure.html#pseudo] Another ask related with your question [http://stackoverflow.com/questions/6447045/css3-selector-first-of-type-with-class-name] – Juan Picado Aug 11 '12 at 13:02