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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:49:54+00:00 2026-05-31T18:49:54+00:00

A minimal code that reproduces the problem is as follows: <div class=cell> <input type=text

  • 0

A minimal code that reproduces the problem is as follows:

<div class="cell">
  <input type="text" size=1>
  <textarea style="display:none;"></textarea>
</div>
<script type="text/javascript">
  $('.cell input').focusin(function() {
    $(this).hide();
    $('.cell textarea').show().focus();
  });
</script>

When the input element is clicked, it should be hidden and the textarea should be shown and focused. This works fine, but only in IE (even IE9) the textarea behaves like readonly, though it is focusable and the readonly attribute is not set. When the textarea is clicked again, it becomes editable.

Also I tried select() instead of focus(), as suggested in IE readonly textarea problem but no difference in the result.

What am I missing?

  • 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-31T18:49:55+00:00Added an answer on May 31, 2026 at 6:49 pm

    For some reason if you focus it right away, you can’t type in it. But, if you wait a bit before focusing it, it works. If you focus it inside a setTimeout(func, 0), it works.

    Using 0 as the milliseconds arguments in setTimeout basically pushes the function to the bottom of the call stack, and sometimes that fixes stuff. Not really sure why.

    EDIT: This question explains why this works: Why is setTimeout(fn, 0) sometimes useful?

    $('.cell input').focusin(function() {
        $(this).hide();
        $('.cell textarea').show();
        setTimeout(function(){
            $('.cell textarea').focus();
        }, 0);
    });​
    

    DEMO: http://jsfiddle.net/aUDJn/1/

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

Sidebar

Related Questions

Here's a minimal code that puzzles me : #include <list> class A; class A
Here is a minimal code that shows the problem: template<typename To, typename From> To
I have created a new solution with a minimal amount of code that represents
This is a minimal test case of some code that I actually have. It
I want to give a minimal js code to random websites so that they
Here's an interesting problem to solve in minimal amounts of code. I expect the
I am having an issue converting type. I was trying code like this (minimal,
We're building a site that will have very minimal code, it's mostly just going
I'm working updating some legacy code that does not properly handle user input. The
Here's a minimal version of the code that took me a lot of time

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.