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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:53:38+00:00 2026-06-17T13:53:38+00:00

I swear, this question is probably some where else but I can’t find it!!!

  • 0

I swear, this question is probably some where else but I can’t find it!!!
But here it goes:
http://jsfiddle.net/YUgxE/

Javascript:

var update = $("#CalcUpdate");
var content = document.getElementById("CalcContent");

update.click(function() { //update
    content.innerHTML += "<div style='display: none' class='CalcOn'><input type='field' value='' class='CalcName'/>";
    obj = $(".CalcOn");
    obj.slideToggle(400,function() {
        obj.removeClass();
});

});

HTML:

<button id="CalcUpdate">update</button>

Really behind this is two problems:

  1. Every time a new field is created, the previous field values are erased. (I don’t know why, it’s supposed to add new innerHTML lines, why do the previous values erase?)
  2. If I rapidly click update, the functions overlap and I don’t know how to make one execute before the other in this format. I’ve seen other questions but they all involve using two functions or something else which I’m not trying to do.
  • 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-17T13:53:39+00:00Added an answer on June 17, 2026 at 1:53 pm

    You’re using jquery, so put it to use! 🙂 Here’s how I updated your script:

    http://jsfiddle.net/YUgxE/3/

    var $update = $("#CalcUpdate");
        var $content = $('#CalcContent');
    
    $update.click(function() { //update
            var $obj = $("<div style='display: none' class='CalcOn'><input type='field' value='' class='CalcName'/>");
        $obj.appendTo($content).slideToggle(400, function() { $obj.removeClass() });
    });
    

    Items of note:

    • Using jquery to look up content, similar to the way you looked up the update region
    • Use jquery to construct a new object ($obj) instead of using innerHTML and adding the string
    • using jquery append/appendTo to add $obj to $content instead of using innerHTML
    • using $obj directly to do the slideToggle (thus, no lookup). This fixes the timing/order of operations problem you were seeing when clicking quickly.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I swear I have seen this done before but can not find it now.
I swear this script worked fine last night but can't get it to work
This is probably a stupid question, but... I've got an application that sends emails
Ok, so I swear this question should be all over the place, but its
I swear this used to work, but it's not in this case. I'm trying
I may be completely off on this, but I swear I remember reading somewhere
This might be a stupid question, but is there a rule that states that
The question probably sounds a little odd, but the actual task is relatively simple,
I swear I have poured and poured over every other similar question on this
I swear... i hope this is the last question I have to ask like

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.