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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:40:34+00:00 2026-06-06T19:40:34+00:00

I’m working on a site where clicking on a td cell creates a text

  • 0

I’m working on a site where clicking on a td cell creates a text input (or select/option dropdown) which is set to the current value of the td and the text input is given the focus.

This version allows people to click on a td to put the content into a text input, possibly edit it, and press enter or click somewhere else or change windows to blur it and save it to the td:

http://jsbin.com/emuneq/7/edit#source

The problem is that clicks happen on mouseup and blurring happens on mousedown so the automatically resizing table changes between the mousedown and mouse up.

This can be seen by clicking on the first yellow cell (it creates a text field when the mouse is released), then slowly clicking and releasing the mouse on cell 2. While you press the mouse down, the previous text field is blurred and this resizes the table cells and when you release you are now in cell 3. For a click to work, the object for the mousedown and mouseup must be the same, but mouse down was made in cell 2 and mouse up was in cell 3, so no click is detected.

This version uses the mouseup event:

http://jsbin.com/emuneq/8/edit#source

If you click on cell 1, then mousedown on cell 2 (blurring the previous text field), then stay in the same position it will mouseup over cell 3 and a text field will be created in cell 3.

What I want to happen is the text field creation happen on mousedown, before the table columns are resized.

This version uses the mousedown event:

http://jsbin.com/emuneq/13/edit#source

I added “e.preventDefault();” to the mousedown function – if this isn’t there the blur function stops mousedown from working.

“focus()” allows you to type text or press delete at the left side of the text field but it seems to completely ignore mouse clicks to move the cursor around or select the text… though you can move the text cursor using the arrow key.

Well in IE7 and IE8 it detects you pressing enter, but you can’t initially type in anything until you use the mouse to give the text input focus. With the mouse you can also highlight the text or move the text cursor around.

But in IE9 and Firefox 11 the text input ignores the mouse. In Chrome 19, focus() highlights the text but it also ignores the mouse completely.

Anyway, the previous link is almost perfect except that it ignores the mouse in the text field (except for IE7 and IE8).

Here is a version that uses a select/option dropdown instead of a text field:

http://jsbin.com/emuneq/15/edit#source

This uses mousedown like before – but the dropdowns won’t open at all in IE9, Firefox, and Chrome. They work fine in IE7 and IE8.

  • 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-06T19:40:35+00:00Added an answer on June 6, 2026 at 7:40 pm

    This works:
    http://jsbin.com/uruhiz/2/edit

    The solution is to check on mousedown whether cell changed or not and to not preventDefault in the second case.

    UPDATED:

    Version with inputs:
    http://jsbin.com/uruhiz/4/edit

    Version with dropdowns:
    http://jsbin.com/eriyuw/2/edit

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

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a French site that I want to parse, but am running into
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but

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.