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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:56:16+00:00 2026-06-08T19:56:16+00:00

I have 2 checkboxes constructed after performing an ajax call. When I try to

  • 0

I have 2 checkboxes constructed after performing an ajax call. When I try to reference their ids to do .change() event, the event won’t trigger. Any ideas? Here is my code:

Ajax call:

    $.ajax({                        
    url:"../includes/MC.Admin.ajax.php",
    type: "POST",
    data: empupdatedata,
    success: function(empupdate) {              
    var empupdateJson = $.parseJSON(empupdate);

                  $("#empupdateinfo_tbl").html(empupdateJson.updateempinfo);

                $("#empemploymentupdateinfo_tbl").html(empupdateJson.updateempemploymentinfo);


                $('#employee-update').bPopup({
                    modalClose: false
                });

                }
        });

This is where the textbox is constructed:

if($rm5->isbonus == 1 && $rm5->isallowance == 0)
{
    $updateemployeeemploymentinfo .= "<tr><td class = 'tbl_data'>
    Additional Payment</td><td>Bonus <input type = 'checkbox' 
    name = 'isbonus' id = 'uisbonus'> Allowance <input type = 'checkbox' 
    name = 'isallowanece' id = 'uisallowance'></td></tr><tr></tr>"; 
}

I want to use the id’s of those two check boxes to trigger a change event using the following codes:

$("#uisbonus").change(function(){
    if($(this).attr("checked"))
    {
        $('#uamountcon').append("<td id = 'uamountcon'><input type = 'text' id = 'uamount ></td>")

    }
    else
    {
         $('#uamountcon').html();
    }
});

$("#uisallowance").change(function(){
    if($(this).attr("checked"))
    {
        $('#uamountcon').append("<td id = 'uamountcon'><input type = 'text' id = 'uamount ></td>")
    }
    else
    {
         $('#uamountcon').html();
    }
});//I placed this code insidethe $(document).ready(function() { });

Is the position of the change event wrong? Where should I put the event? Or what is the problem? Thanks!

  • 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-08T19:56:18+00:00Added an answer on June 8, 2026 at 7:56 pm

    Since you are adding them after the page has loaded you will have to use on() or delegate() for event delegation. on() was added in 1.7, however, for prior versions delegate() is the most effective means to use event delegation.

    $("body").delegate("#uisbonus", "change", function(){ 
    ...
    $("body").delegate("#uisallowance", "change", function(){ 
    

    It may be better to reference a class instead of an id:

    $("body").delegate(".uiClassName", "change", function(){ 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have Checkboxes in page with IDs like below a_chk1, a_chk2, a_chk3, b_chk1,
I have checkboxes on my page for which I would like to send their
I have constructed a array that gets the information from checkboxes. This is working
I'm using the SimpleFormController and have checkboxes in the view. When the form is
For example, i have checkboxes: <input type='checkbox' name='fruit' value='apple'> Apple <input type='checkbox' name='fruit' value='orange'>
He, I have this page where i have checkboxes next to every item in
I have ten checkboxes and Enum. I want to bind this checkboxes to Enum.
I have two checkboxes. I need to check that at least one of them
I have two checkboxes generated like this: <table> <?php foreach ($invited_members as $mem) :
I have created checkboxes. When I selected multiple checkboxes then how can I get

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.