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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:25:12+00:00 2026-06-12T10:25:12+00:00

Previously, the code I was using was working. But today, when I re-used the

  • 0

Previously, the code I was using was working. But today, when I re-used the code, it is not working at all.

Code/Case situation:
I pre-defined an html code which inserts a new form after an existing default form. I am trying to use jQuery to add a click function to one of the buttons in the new form.The jQuery code is

$("button[value='ADDTSG']").click(function(){
    var NEW = "<div class='w175 mR9 mB9 p9 rCor cWhi' id='fL'><form action='pro/lab_handle.php' method='post'><input type='hidden' value='0' name='LID'/><div class='w65 B ttU mR9' id='fL'>TPC</div><input type='text' class='w65 Dg4' name='QTPC'/><br/><hr/><button value='NEWTSG' name='BTN' type='submit'><img src='img/add.png'/></button><button id='fR' type='button' value='XTSG'><img src='img/del.png'/></button></form></div>";

    $(".FORCLONE").after(NEW);
    $("button[value='ADDTSG']").hide();
    $("button[value='SAVETSG']").hide();
});

// buttons below not alerting at all, no function after click on it
$("button[value='XTSG']").click(function(){
    alert("close tsg"); return false;
});
$("button[value='NEWTSG']").click(function(){
    alert("new tsg"); return false;
});

The html for the default form is

<div id='fL' class='FORCLONE'>
<div id='fL' class='w175 bgBlu1 mR9 mB9 p9 rCor cWhi'>
    <form method='post' action='pro/lab_handle.php'>
        <input type='hidden' name='LID' value='1'>
        <div id='fL' class='w65 B ttU mR9'>TPC</div><input type='text' name='MTPC' class='w65 Dg4' value='555'>
        <button type='submit' name='BTN' value='SAVETSG'><img src='img/ok.png'></button>
        <button id='fR' type='button' value='ADDTSG'><img src='img/add.png'></button>
    </form>
</div>
</div>

Can anyone tell me why this is not working? By the way, I am using FireFox with web-developer plug-in, and there is no javascript error shown even i click on the “XTSG” / “NEWTSG” buttons.

  • 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-12T10:25:14+00:00Added an answer on June 12, 2026 at 10:25 am

    Use .live() (for older jquery versions – < v1.7):

    $('#btnALERT1').live('click', function()
    {
       alert("Hello");
    });
    

    Or:

    $(document).delegate('#btnALERT1', 'click', function() 
    {
       alert("Hello");
    });
    

    Use .on() (for new jquery versions – >= 1.7):

    $(document).on('click', '#btnALERT1', function()
    {
       alert("Hello");
    });
    

    Source.

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

Sidebar

Related Questions

I used this code previously in netbeans 6.9.1 but it does not seem to
I am working on some code that previously was using a cfquery, and is
I am using ASP.NET MVC3 with EF Code First. I have not worked previously
I've been using Javascript's Date for a project, but noticed today that my code
Previously when I browsed source code files using Xcode's file browser (located on left
I am refactoring some legacy code. The app was not using querystrings. The previous
I don't understand why I'm getting this error. I used the same code previously
I put together some VBA code for Outlook 2007 which has been working predominantly
I've checked all kinds of previously answered similar questions and nothing's working. I have
Previously I used a database initializer to seed or pre-populate my tables when creating

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.