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

  • Home
  • SEARCH
  • 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 8569821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:25:31+00:00 2026-06-11T18:25:31+00:00

jQuery(function ($) { $(‘input.adud’).on(‘click’, function() { var thisdiv = $(this).parents(‘div’).attr(id); var thisform = $(this).parents(‘form’).attr(id);

  • 0
jQuery(function ($) {
    $('input.adud').on('click', function() {
        var thisdiv = $(this).parents('div').attr("id");
        var thisform = $(this).parents('form').attr("id");
        var thistable = $(this).parents('form').attr("class");
        var thisbutton = $(this).attr("id");
        var stuff = new Array();
        stuff = $("#"+thisform+" :input");
        stuff.push({name:"table", value:thistable});
        stuff.push({name:"button", value:thisbutton});

        $.ajax({
            url: "<?php echo site_url('clients/ajax/modifyclients');?>",
            type: 'POST',
            data: stuff,
            success: function(msg) {
                $('#'+thisdiv).html(msg);
            }
        });

        return false;
    });
});

I have a page with many sets of forms. Each set is seperated/identified by a unique div id.

Each set has a form to enter data at the top and underneath are the forms populated with relevant existing data.

I use jQuery and AJAX to enter or update the data into a database. The php AJAX file returns the complete html form set that had been operated on.

The problem is the buttons on the returned html don’t work, in other words the AJAX call can not be made a second time.

I believe I have to use .on() to get around this but I am unable to completely grasp how its done/ or how to set up the jQuery functions.

I know this question has been asked 100 times, but I guess finding the answer that fits your particular problem is the key 🙂

  • 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-11T18:25:32+00:00Added an answer on June 11, 2026 at 6:25 pm

    The simplest :

    $(document).on('click', 'input.adud', function() {
    

    Better :

    Find a persistent element in which all your dynamically added inputs are and do

    $(thisElement).on('click', 'input.adud', function() {
    

    When using on, you must apply it on a collection that is yet present and that will still be present later, and provide the selector of the elements (which may appear later) which may be clicked.

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

Sidebar

Related Questions

My jQuery function is this: $(function() { $('#small').click(function() { var selectedRB = $('input[name=radioGroup]:checked').val(); alert(selectedRB);
I'm using this jQuery function to jumping on input styled components of the form:
I have this jQuery function : $('a[name=pmRead]').click(function(e) { e.preventDefault(); $(this).parents(.pmMain).find(.pmMain5).toggle(); $.ajax({ type: 'POST', cache:
Here's a JQuery function: $(label[for='ch_c'], label[for='ch_ad']).click( function(){ if( $(this).hasClass('active') ){ $('#box').fadeIn(300); } else {
I am using jquery function which changes the class of element $(a).click(function(){ $(this).closest(ul).find(a).parent().removeClass(active); $(this).parent().addClass(active);
Jquery function updateTextArea() { var allVals = []; $('#c_b :checked').each(function() { allVals.push($(this).val()); }); $('#textarea').val(allVals)
I have a jquery function ('rater') that I call this way: <div id=someID></div> <script
I have the following jQuery function: function GetGrandparentDiv(item) { return item.parents('div:eq(1)'); } Which is
I have this jquery function --- function domail_slide_settings(obj) { $(div# + obj).toggle(); } and
I have this jquery function that works, except I need to add something. I

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.