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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:54:52+00:00 2026-05-30T21:54:52+00:00

I am using the exact code seen here: http://gazpo.com/downloads/tutorials/html5/contentEditable/ As you can see, when

  • 0

I am using the exact code seen here:

http://gazpo.com/downloads/tutorials/html5/contentEditable/

As you can see, when the grey box is clicked the save button appears
however after using this exact code on my own site when the page loads
or is refreshed the save button is shown. After clicking somewhere on
the screen (other than the grey box) it is hidden.

Can anyone think of a reason why it is initially showing?

I am pretty new to jquery.

My code:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
   <script>
    $(document).ready(function() {

    $("#save").click(function (e) {         
        var content = $('#editable').html();    

        $.ajax({
            url: 'save.php',
            type: 'POST',
            data: {
            content: content
            },              
            success:function (data) {

                if (data == '1')
                {
                    $("#status")
                    .addClass("success")
                    .html("Data received successfully.")
                    .fadeIn('fast')
                    .delay(3000)
                    .fadeOut('slow');   
                }
                else
                {
                    $("#status")
                    .addClass("error")
                    .html("An error occured, the data could not be saved")
                    .fadeIn('fast')
                    .delay(3000)
                    .fadeOut('slow');   
                }
            }
        });   

    });

    $("#editable").click(function (e) {
        $("#save").show();
        e.stopPropagation();
    });

    $(document).click(function() {
        $("#save").hide();  
    });

});

  </script>

  <body>

                                    <div id="status"></div>
                <div id="content3">
                <div id="editable" contentEditable="true">
                Lorem ipsum dolor sit amet...
                </div>
                <button id="save">Save</button>
                </div>
</body>

CSS:

#status{
display:none;
margin-bottom:15px;
padding:5px 10px;
border-radius:5px;
}

#save{
display: none;
margin: 5px 10px 10px;
}

#content3{
    background: #f7f7f7;
    border-radius: 10px;
}

Adding an overriding style solves the problem…just not sure why the css isn’t doing the job

    <button id="save" style="display:none;">Save</button>
  • 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-30T21:54:54+00:00Added an answer on May 30, 2026 at 9:54 pm

    A quick inspection tells me that the button has a default CSS style of display:none; before JQuery ever even gets ahold of it. That style comes from the head of the document.

    After somewhere on the page is clicked, then the JQuery triggers, applying either display:none; or display:inline; to the button, depending on the target of the click. This is added to the style attribute of the element itself, overriding the style from the document head.

    As a side note, this is often done to prevent the element from briefly appearing on the screen before any Javascript has a chance to run and hide it.

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

Sidebar

Related Questions

When using Ninjects ConstructorArgument you can specify the exact value to inject to specific
I have two sites using the same exact code for @font-face. The font files
I am building an iFrame and am using document.location.href -> my exact code is:
I'm using this exact code on two pages, and on one of the two
I'm using the exact code from the iPhone Application Programming Guide Multimedia Support to
I'm using the exact code that 1and1 suggests for backing up MySQL DBs through
i am experiencing some weird behaviour here. i am using the following code to
I'm writing a POS application for the iPhone/iPod combination, using the same exact hardware
Exact Duplicate of: Getting the size (free,total) of a Windows Mobile phone drive using
How do i achieve Exact Phrase functionality on this field using BooleanQuery/any other class?

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.