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

  • Home
  • SEARCH
  • 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 7897429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:09:51+00:00 2026-06-03T08:09:51+00:00

<div id=form_title> <h1>Form Title</h1> </div> This is my HTML code. I want to make

  • 0
<div id="form_title">
    <h1>Form Title</h1>
</div>

This is my HTML code. I want to make a text box appear whereby user can change the value of h1 and save it.

Here is my attempt.

$('#form_title').click(function() {
    $(this).html('<input id="form_title_value" name="form_title_value"
                         type="text" placeholder="Enter Form Title..."> ');
});​

The problem is that the textbox looses focus when I click on it.

  • 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-03T08:09:52+00:00Added an answer on June 3, 2026 at 8:09 am

    Use this:

    $('#form_title').one('click', function() {
        $(this).html('<input id="form_title_value" name="form_title_value" 
                             type="text" placeholder="Enter Form Title...">')
                   .find('input').focus();
    })​;
    

    Live DEMO

    The problem is that you override the innerHTML of the div with each click.
    So it no just “loose focus” but it loose the innerHTML with each click.

    one lets you attach a callback that will fire only once.


    You can try this DEMO as well, that shows you how you can change the <h1> text

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

Sidebar

Related Questions

I have form like this : <div id='add_field' class='locbutton'><a href='#' title='Add'>Add</a></div> <div id='remove_field' class='locbutton2'><a
I want to display a form in a Div, in alert box. How would
I have form like this: <div class=satu> <input type='text' size='1' maxlength='1' name='score[1][]' id='score[1][]'> </div>
So the following code: $product_id = $(this).parent().parent().html(); Produces this: <div class=right> <input value=6 name=quantity
i have the following code : <html> <head><title></title> <script> function showMe (it, box) {
I want to invoke my jsp page from my index.html.This is html code. <html>
I would like it that when the user clicks out of the #email-form div,
I have a html page with a form. The form has Div which gets
Here is my code i am using for custom search, <div id=cse-search-form style=width: 100%;>Loading</div>
This code displays a Jquery dialog with an html textbox that is shown after

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.