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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:31:46+00:00 2026-06-18T19:31:46+00:00

I have two elements: A texfield element, firstly hidden. And a button element covering

  • 0

I have two elements:

  1. A texfield element, firstly hidden.
  2. And a button element covering the textfield.

In other hand, I have one event called onDoubleClick which calls a function when a double click is made in the button. This function hides the button and show the textfield, but I need that the textfield is editable in this moment (like make a third click)

I read about focus() but it doesn’t help me… http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_html_blur

How can I obtain it?

EDIT:

I’m obtaining well the input element:

var htmlElement = document.getElementById(this._tabsTitle[pos]._hPath);
var input = htmlElement[0];
input.focus();

The htmlElement var is a form, and the input var is the input field, I obtain it well, I’m looking with chrome inspector, with debugger, but focus() doesn’t work…

SOLUTION

It’s was mine mistake…this code is part of a big project, and focus was working fine, but didn’t make anything due to a thread problem … I checked it and solved it, and now it works like a charm 🙂 thanks to all

Regards, Daniel

  • 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-18T19:31:48+00:00Added an answer on June 18, 2026 at 7:31 pm

    check this fiddle. I believe it does what you want.

    html

    <input type="text" style="display:none" id="txtField1" />
    <input type="button" id="btn1" value="Double Click Here" />
    

    js

    function modify() {
       //lets hide the button
       document.getElementById("btn1").style.display= "none";
       // show the text field
       document.getElementById("txtField1").style.display = "block"; 
       // now focus on the field
       document.getElementById("txtField1").focus();  
    }
    
    var el = document.getElementById("btn1");
    // attaches event to the button
    el.addEventListener("dblclick", modify, false);
    

    UPDATED according to comments on top(below question).

    if you dont want the button to be hidden and make its value null.

    replace the line

    document.getElementById("btn1").style.display= "none";
    

    by

    document.getElementById("btn1").value= "";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two elements which overlap, one on top of the other. Half of
I have two elements in a div element. One is styled to float left
I have two elements one in top of the other: <form class=order-form></form> <a href=#
I have two div -elements, the top one has the height of 40% and
OK, I have two HTML select elements and a button. I need to disable
I have two elements on my form - textarea and file element for file
I have two elements on a page. One being the main content container and
I have two elements, adult no and children no, at least one field is
I have two elements, the first one is the default to print on screen
I have two elements: 1. A parent of fixed height, overflow:hidden 2. Its child,

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.