Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4024512
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:43:51+00:00 2026-05-20T10:43:51+00:00

I am using dojo.query(‘input,select’,myDiv)[0].focus(); to focus the first input element found in a div

  • 0

I am using

dojo.query('input,select',myDiv)[0].focus();

to focus the first input element found in a div container.

This will work in Firefox, but not in IE 7.

IE 7 only takes the first query into consideration:

dojo.query('input,select')[0] will select the first input element, 
  even if a select element is first.

dojo.query('select,input')[0] will select the first select element, 
  even if an input element is first.

Does anybody know a workaround for this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:43:52+00:00Added an answer on May 20, 2026 at 10:43 am

    If I recall correctly, dojo.query does not necessarily guarantee “chronological” order within the NodeList it returns, especially for complex queries. This is generally due to the fact that for some browsers / in some scenarios, it does have to cobble multiple disparate result sets together, and trying to reorder this based on where each element is in the document would probably be far more of a performance hit than it’s worth.

    That said, off the cuff I’m not sure what to suggest as an alternative. It’d be easy enough to find the first of one OR the other separately, just not while looking for both within the same query.

    If your form has some kind of consistent markup around your inputs (e.g. each field is inside let’s say, a div with class="field"), I suppose you could do something like this:

    dojo.query('.field:first-child select, .field:first-child input')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using dojo. I've got something like this: <a id=fooBar onclick=foo();bar();>Foo then Bar</a> I
I'm implementing a table with a fixed header using this kind of setup: <div
I'm using Dojo 1.5 to create a dijit.form.Select with some data from a datastore.
I am using DOJO for data grid presentation <div id=grid_log dojoType=dojox.grid.DataGrid store=log structure=window.layout_log queryOptions={deep:true}
I'm looking at using the Dojo Objective Harness (DOH) for testing some custom JavaScript
I'm using the following html to load dojo from Google's hosting. <script src=http://www.google.com/jsapi></script> <script
I'm using Dojo.dnd to transfer items between to areas. The problem is: the items
How can I call dojo.query with button on my page so that I save
I'm just getting started with dojo, and I've understood that dojo.query is the same
I am having an issue trying to post a JSON string using dojo.xhrPost to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.