0

I don't know what its term, it's like when have a non empty HTML input text then while the focus is on before that input's tabindex, you hit the TAB key, then it has a blue selection around the text.

How do you do that with Javascript?

2 Answers 2

2

I think you mean "Selection". Look at the javascript DOM functions select() and focus(). e.g.

<input type="text" id="myTextBox" />

<script type="text/javascript">

    var myTextBox = document.getElementById('myTextBox');
    myTextBox.select();
    myTextBox.focus();

</script>
Sign up to request clarification or add additional context in comments.

Comments

0

I thick you would like to apply some css to the the text box. in onfocus say you have a class called as selected for which you give a certain order.

and on blur you remove the class attribute.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.