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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:56:42+00:00 2026-05-23T18:56:42+00:00

I have a TD that contains two divs. The first div contains text and

  • 0

I have a TD that contains two divs. The first div contains text and is visible. The second div contains a textarea and is hidden by default. Using the code below, I’ve bound to the click event of the TD and swapped the visibility of the div’s on click:

$(".tdEstimatorNote").click(function (e)
{
    $(this).find("div:first").toggle("400");
    $(this).find("div:first").next().toggle("400");
    $(this).find(".estimatorNotesTA").focus();
});

Although this works, it created an issue with the textarea. When I attempted to put the focus on the textarea after it became visible, the div’s would swap visibility again (because I’m bound to the click event of the TD). So, my solution, stop the event propagation:

$(".estimatorNotesTA").click(function (event)
{
    event.stopPropagation();
});

This works – sort of. I’m able to freely edit and click inside the textarea now, but I’m not able to range select any text (I’m assuming because of the jQuery above). It’s possible that my assumption is incorrect, because I’m unable to range select text via the keyboard as well (shift + end or shift + home). Any thoughts / suggestions?

  • 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-23T18:56:44+00:00Added an answer on May 23, 2026 at 6:56 pm

    Not sure where the problem comes from, but you can just test whether the textarea was clicked:

    $(".tdEstimatorNote").click(function (e){
        if(!$(e.target).hasClass('estimatorNotesTA')) {
            //Toggle CSS class
            // use method chaining :)
            $(this)
               .find("div:first").toggle("400");
                  .next().toggle("400").end()
               .end()
               .find(".estimatorNotesTA").focus();
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div that contains two other divs,, like this: ---------------------------- | |
I have two DIVs, first one has a link in it that contains the
I have a div which contains two nested divs, one that specifies a height
I have an ASP.NET page that contains two div's. Both have search fields and
In my HTML code, I have a form tag that contains two input boxes,
I have a that contains two nested div's. One of the nested div's contains
I have a string that contains two numbers and some text. I want to
I have a content div, that has a header div, which contains two other
I have a two-column layout. I have a #mainContainer div that contains all of
I have a div which is centred on the page that contains text loaded

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.