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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:02:55+00:00 2026-06-03T07:02:55+00:00

I am very new to javascript and hit a wall. Basically I have a

  • 0

I am very new to javascript and hit a wall.

Basically I have a form with a few fields used to make requests (I am working with someone elses code).

One of the features of this form is the ability to send multiple requests, by selecting the amount of requests from a drop down, that many duplicates of the form will load using ajax.

I recently added 2 new fields to this form. A checkbox and a text field. Using jquery I did a simple toggle so that if the checkbox is checked, the text field will appear.

<tr>
    <td>
        Allow Checkbox
    </td>
    <td>
        <input type="checkbox" name="Check_1" id="Check_1" value="2" />I accept
    </td>
</tr>
<tr id="Row_1" style="display:none;">
    <td>
        Here is a text field
    </td>
    <td>
        <input type="text" name="field_1" id="field_1" value="" />
    </td>
</tr>
<script>
                        $('#Check_1').click(function() {
                        $("#Row_1").toggle();
                        });
                        </script>

This is working as expected, however it is not working when I select multiple requests. The tables that are loaded via ajax are not loading the javascript part of it, so those fields are not toggled when checked,

I have checked the syntax and everything seems fine. The php is returning the correct field id’s ie #Check_2 , #Row_2 , #Check_3, #Row_3 etc etc same for the javascript , it is correct. But how can I get the jquery to load when it is rendered?

  • 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-03T07:02:57+00:00Added an answer on June 3, 2026 at 7:02 am

    Since the new fields come in dynamically, the .click handler is not attached.

    Try using:

    $('#Check_1').live("click", function() {
        $("#Row_1").toggle();
    });
    

    — Update —

    I just saw that you mentioned your ids are changing. In that case, I would suggest you add another attribute to your html, and use that as the selector.

    Eg:

    <tr>
        <td>
            Allow Checkbox
        </td>
        <td>
            <input type="checkbox" name="Check_1" id="Check_1" value="2" data-toggles />I accept
        </td>
    </tr>
    <tr id="Row_1" style="display:none;" data-togglable>
        <td>
            Here is a text field
        </td>
        <td>
            <input type="text" name="field_1" id="field_1" value="" />
        </td>
    </tr>
    

    And then, use the new toggles and togglable data attributes

    $('[data-toggles]').live("click", function() {
        if ($(this).is(":checked")){
            $(this).parents("tr").siblings("[data-togglable]").show();
        } else {
            $(this).parents("tr").siblings("[data-togglable]").hide();
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm very new to JavaScript in general so having trouble with this. Working with
I am very new at jQuery ... I've used Javascript many times and am
I am new to javascript so sorry I don't know very much. I have
I am very new in Javascript. I want to make some basic stuffs that
I am very new to Javascript MVC frameworks and have a question related to
I'm working on a Javascript/jQuery powered image preloader, and have hit a bit of
I am very new to javascript and have been using the JQuery library quite
I'm very new to JavaScript, and I have a webpage with 3 nested frames
Hello I a very new to Javascript and I need to make a code
I am very new to Javascript so please be patient. I have a script

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.