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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:33:31+00:00 2026-06-12T11:33:31+00:00

The following jsfiddle … http://jsfiddle.net/mqVUU/ … is a simple input field UI tweak. The

  • 0

The following jsfiddle … http://jsfiddle.net/mqVUU/ … is a simple input field UI tweak. The goals are:

  • on focus, enlarge the input (via animate)
  • on focus, select current input content
  • when ‘enter’ is pressed in the input, blur the input
  • on blur, shrink the input

Here’s the script so far …

$('input').on({
    focus: function(){
        $(this).animate({'width':200}, 300, 'easeInOutBack');
        $(this).select();
    },
    keydown: function(e){
        if (e.keyCode == 13) {
            $(this).blur();
        }
    },
    blur: function(){
        $(this).animate({ 'width':100}, 300, 'easeInOutBack');
        $('#result').html( $(this).val() );
    }
});

Can anyone help with these questions …

  1. If I put it in the animate() callback, anything the user types while the animation is occurring gets overwritten, which is problematic. So what’s the best way to get the select() working properly?
  2. Is the keydown parameter really the only way to accept enter as a trigger??

Thanks for any pointers 🙂

  • 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-12T11:33:33+00:00Added an answer on June 12, 2026 at 11:33 am

    In webkit browsers (Chrome and Safari), a simple .select() doesn’t always work, because the default action for mouseup is to clear the selection. So you need to add this handler:

    mouseup: function(e) {
               e.preventDefault(); 
            }
    

    As far as the keydown — that is the best way to do it. There are others, but they won’t give you any advantage.

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

Sidebar

Related Questions

I am sure this is simple but... I have the following: http://jsfiddle.net/SUBH3/1/ HTML: <div
I have the following animation: http://jsfiddle.net/jtqcj/2/ jQuery(#fp-small-feature-1).mouseenter(function(){ jQuery(.bar).animate({width: 264px},500); }); jQuery(#fp-small-feature-1).mouseleave(function(){ jQuery(.bar).animate({width: 0px},800); });
http://jsfiddle.net/JamesKyle/y7hBQ/ I'm making a simple jquery counting function that adds the following classes: First
Hi I have setup the following jsFiddle http://jsfiddle.net/a9ugu/2/ I am wondering why I get
http://jsfiddle.net/SXrAb/ Following the jsfiddle link there is a simplified sample of what I need.
I have following fiddle: http://jsfiddle.net/BFSH4/ As you see there are two issues: The h1
I have the following fiddle1 http://jsfiddle.net/y6tCt/35/ . I need to build the checkbox list
I have the following problem: http://jsfiddle.net/DerNa/12/ Which is demonstrated more clearly the jump here:
I have the following arrays: http://jsfiddle.net/3NZsK/ I need to sort the arrays by their
I have the following code: http://jsfiddle.net/uRCL2/1 At the moment the result is shown in

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.