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 8008575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:10:46+00:00 2026-06-04T18:10:46+00:00

Edit: If you have not developed on Windows 8, do not try to answer

  • 0

Edit: If you have not developed on Windows 8, do not try to answer this question. Do not vote on it. Do not even read it. This is not a web app or website and does not run in a browser. Please stop down-voting content you do not understand. This is a Windows 8 METRO HTML5/js application that runs in the Windows Runtime environment.

Original Question:

I want the cursor to be “blinking” in the input box, ready to receive input. I’m using javascript to set the focus. This isn’t working:

document.querySelector("#input-box").focus();

Anyone know why? Is the focus method not the correct one to use for this?

Thank you.

Edit #2: So it definitely has something to do with the fact that I am trying to set focus to the input from a ListView’s “itemInvoked” event. The event is firing properly, the element is accessible from the event handler, and the line has no errors on execution. I can set focus to my input tag from a standard button click event, but not from an ItemInvoked event. So the question is, why can’t I set focus from within this event handler?

  • 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-06-04T18:10:48+00:00Added an answer on June 4, 2026 at 6:10 pm

    I have created this little test project with only a textbox and in the onload set the focus in exactly the same way as you do. I tried it both on the emulator and on my local machine and both methods seem to work.

    Could you try if this project is working for you on your machine? And can you give us some more insight on when you are trying to set the focus? Right now in your question there is not that much information about when it’s happening.

    You can download the sample over here http://www.playingwith.net/Temp/TestFocusApplication.zip

    Update

    Okay, seem to found it, if you call the msSetImmediate function with the function that sets focus to the textbox it seems to work. I don’t have an option to upload the test example, so below you find the code where I attach the ItemInvoked handler and call the setFocus function.

     var listView = document.getElementById("basicListView");
    
                    listView.winControl.addEventListener("iteminvoked", function (evt) {
                        if (listView.winControl.selection.count() > 0) {                        
                            msSetImmediate(setFocus);
                        }
                    });
    
    function setFocus() {
                //Set focus on input textbox;
                var input = document.querySelector("#input-box")
                input.focus();
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: I rephrased the question because I have not explained well. Let's see if
EDIT : You're not allowed to have the word question in the title. Q-mark
Edit: I have added an answer on how to fix this in case someone
edit: What is not working:- i have a two columns (approve all/reject all) how
I have the following code [in doPost()] to edit existing record. It does not
EDIT i have something like this in a file: imagecolor=0 arrayimagecolorcopy=0 arrayimagecolorcopy3d=0 when i
My company has a desktop app originally developed for Windows XP. The original programmer
Greetings! I have developed a Windows Service that seems to install just fine most
I have an issue that on one computer applications developed using the Windows Presentation
I have a VS2008 C++ application for Windows XP SP3 developed using WTL 8.1.

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.