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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:03:39+00:00 2026-05-29T06:03:39+00:00

For some reason, my script isn’t writing out the text after I remove the

  • 0

For some reason, my script isn’t writing out the text after I remove the textbox element. Am I incorrectly using the .html or is something else wrong?

        $('.time').click(function () {
            var valueOnClick = $(this).html();
            $(this).empty();
            $(this).append("<input type='text' class='input timebox' />");
            $('.timebox').val(valueOnClick);
            $('.timebox').focus();
            $('.timebox').blur(function () {
                var newValue = $(this).val();
                var dataToPost = { timeValue: newValue };
                $(this).remove('.timebox');
                if (valueOnClick != newValue) {
                    $.ajax({
                        type: "POST",
                        url: "Test",
                        data: dataToPost,
                        success: function (msg) {
                            alert(msg);
                            $(this).html("88");
                        }
                    });
                } else {
                    // there is no need to send 
                    // an ajax call if the number
                    // did not change
                    alert("else");
                    $(this).html("88");
                }
            });
        });

OK, thanks to the comments, I figured out I was referencing the wrong thing. The solution for me was to change the blur function as follows:

            $('.timebox').blur(function () {
                var newValue = $(this).val();
                var dataToPost = { timeValue: newValue };
                if (valueOnClick != newValue) {
                    $.ajax({
                        type: "POST",
                        url: "Test",
                        data: dataToPost,
                        success: function (msg) {
                        }
                    });
                } else {
                    // there is no need to send 
                    // an ajax call if the number
                    // did not change
                }
                $(this).parent().html("8");
                $(this).remove('.timebox');
            });
  • 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-29T06:03:41+00:00Added an answer on May 29, 2026 at 6:03 am

    $(this) in your success handler is refering to msg, not $('.timebox') (or whatever element that you want to append the html to)

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

Sidebar

Related Questions

For some reason, on some of my pages, the default validator script isn't rendering
For some reason this script isn't working in Firefox: document.onkeydown=function keypress(e) { if (e.keyCode
For some reason This php script won't echo anything: <?php setcookie(pop,'hi',time()+604800); echo $HTTP_COOKIE_VARS['pop']; ?>
For some reason, we have a script that creates batch files to XCOPY our
For some reason my json twitter parser isn't working? Anyone got any ideas as
For some reason typeface.js isn't rendering my typeface correctly. I can't seem to dig
jQuery for some reason isn't working.I'd like to know what the problem is.Here is
For some reason my simple jquery bind event isn't working. The funny thing is
Ok... First off, I know this isn't a new question. But, for some reason
I'm writing a script where I extract command line arguments using getopt, qualify the

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.