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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:29:51+00:00 2026-05-14T02:29:51+00:00

I have a set of radio buttons that are dynamically generated (via JSON call):

  • 0

I have a set of radio buttons that are dynamically generated (via JSON call):

StringBuilder sbEligAll = new StringBuilder();

sbEligAll.Append("<div id='currentselectiondepartment'>");
sbEligAll.Append("  <input type='radio' name='selectalldepartment' id='radCurrent' value='0' /><label for='radCurrent'>Current</label>");
sbEligAll.Append("  <input type='radio' name='selectalldepartment' id='radFuture' value='1' /><label for='radFuture'>Future</label>");
sbEligAll.Append("  <input type='radio' name='selectalldepartment' id='radCurrentAll' value='2' /><label for='radCurrentAll'>Current All</label>");
sbEligAll.Append("  <input type='radio' name='selectalldepartment' id='radFutureAll' value='3' /><label for='radFutureAll'>Future All</label>");
sbEligAll.Append("</div>");

Then:

return Json(new { TableList = sbElig.ToString() }, JsonRequestBehavior.AllowGet);

Is there a way to get jQuery to be able to interact with these?

For example:

$("input[name=selectalldepartment]").change(function() {
     var str = $('input[name=selectalldepartment]:checked').val();
     $(".radiolist[value='" + str + "']").attr("checked", true);
});

I’ve tried everything I know how to do, but the jQuery just doesnt fire. (I’ve added alerts to the jQuery code to see if it actually gets called, and it does not).

Any thoughts?!

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-05-14T02:29:51+00:00Added an answer on May 14, 2026 at 2:29 am

    Use .live() like this:

    $("input[name=selectalldepartment]").live('change', function() {
         var str = $('input[name=selectalldepartment]:checked').val();
         $(".radiolist[value='" + str + "']").attr("checked", true);
    });
    

    When you run your current code it looks for that selector, and attaches an event handler to those elements…the new elements weren’t there to attach to when it was run. The other option is when you’re adding the controls, add the handler there to the new ones matching the same selector in the response, something like this:

    $.ajax({
        url: blah.aspx...
        success: function(data) {
          //do stuff
          $("input[name=selectalldepartment]", data).change(function() {
            //Code or a function to keep it tidy
          });
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this set of labels and radio buttons that look like this: Entertainment:
I have a set of radio buttons that are for certain products. I am
I have a set of Yes / No radio buttons that I want to
I have a set of radio buttons with labels that I would like to
I have a flex MXML UI that is building a set of radio buttons
I have a set of radio buttons that triggers a jquery function if a
I have a dynamically created list that displays radio buttons next to it. When
I have multiple table rows that has a set of radio buttons on each
I have a set of radio buttons I'm using to append and remove images
I have a set of radio buttons that work when clicked where it will

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.