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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:10:15+00:00 2026-05-31T10:10:15+00:00

jQuery has the .select() method, which lets you execute a function when text is

  • 0

jQuery has the .select() method, which lets you execute a function when text is selected in a text area.

Unfortunately, there is no corresponding .deselect() method for executing a function when the user removes a selection.

How can I detect when the user has unselected the text (for example, by typing, clicking, or defocusing)?

  • 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-31T10:10:16+00:00Added an answer on May 31, 2026 at 10:10 am
    $("textarea").select(function() {
        //do something here
    });
    
    $("textarea").on("blur focus keydown mousedown", function() {
        //do something else here
    });​
    

    .on is used in jquery 1.7 and later. Prior to that you can use .delegate or .live

    http://jsfiddle.net/s29Vb/4/

    It was simplified for the example. You can be more specific with the selector rather than $("textarea").

    Another example if you want to do something on blur focus keydown mousedown only if text has been selected in the first place.

    http://jsfiddle.net/s29Vb/5/

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

Sidebar

Related Questions

I am trying to create a custom jquery function which has two parameters, the
The JQuery has method effectively selects all elements where they have particular descendants. I
Jquery has a great language construct that looks like this: $(document).ready(function() { $(a).click(function() {
I have a JSP which has jQuery and wanted to change the action message
The jQuery UI dialog has a dialogClass option, which is nice, since the dialog
If a page has both JQuery and Prototype then I got conflict. There is
Is there a way in either CSS (IE7+) or jQuery to select items whose
Got an HTML Select with an onChange() event that calls a method which takes
With jQuery UI tabs , you can use the select method to run code
I've seen some posts where jQuery has been favored vs ExtJS. I haven't looked

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.