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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:58:00+00:00 2026-06-10T06:58:00+00:00

I found this question on Stack Overflow, and used the code given in the

  • 0

I found this question on Stack Overflow, and used the code given in the top answer.

It works marvelously otherwise, but there’s a kink; on my page I have multiple textareas. In fact, the selector I used was just "textarea".

However, when ‘tabbing’ from one textarea to another (using the Tab key to jump to the next one), apparently the focus event doesn’t fire, and the text doesn’t get selected.

How do I modify that code to work both by click, and by Tab?

JSFiddle here; http://jsfiddle.net/qQDbZ/ I’m on Chrome, and while clicking on the textarea does select all, tabbing doesn’t.

  • 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-10T06:58:01+00:00Added an answer on June 10, 2026 at 6:58 am

    I was able to get this working with the following workaround:

    $('textarea').focus(function() {
        var $this = $(this);
        $this.select().mouseup(function() {
            $this.off('mouseup');
            return false;
        });
    }).keyup(function(e) {
        if(e.which === 9) {
            this.select();
        }
    });
    

    Demo: http://jsfiddle.net/KfFPM/3/

    I tested the above in Chrome 21, Safari 6, Firefox 14, Opera 12, and IE 9. I’ll test more versions later; I’m happy for now. Works when tab’ing forward, and shift+tab’ing backwards.

    Binding to keydown did not work.

    I still think this workaround should be unnecessary. My best guess is that webkit browsers detect the tab as a keypress inside the textarea and therefore unselect the text, the same as any browser would if you had some text selected in a textarea and then started typing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there's another question like this on stack overflow, but my problem is
I found this answer to this question https://stackoverflow.com/a/7244888/1473523 , but in my situation am
I've found this question on StackOverflow Adding div below images in colorbox But it
I know this question might sound quite silly, but I somehow found myself stuck
Found this question that explained a way to communicate between layers. However there is
I found this question which had an answer to the question of performing batch
I found this question that is discussing what I would like to do, but
I found this question but it was only similar and, more importantly, dated by
This is my first question here on stack overflow. i need help on a
Happy Friday! I assume somebody out there has a simple answer to this question

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.