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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:11:48+00:00 2026-06-07T20:11:48+00:00

I generate this table: with this: $.ajax({ type: POST, url: action, data: dataToSearchProfile, dataType:

  • 0

I generate this table:

each checkbox table

with this:

$.ajax({
    type: "POST",
    url: action,
    data: dataToSearchProfile,
    dataType: "json",
    success: function(response) {

       if(response.success == "success") {
             $('#rBuscarPerfil tr:gt(0)').remove();
             $.each(response, function (index,record){
                 var row = $("<tr class='"+record.IdPerfil+"'/>");
                 $("<td />").text(record.NomPerfil).appendTo(row);
                 $("<td />").text(record.DesPerfil).appendTo(row);
                 $("<td />").html("<a href='#'>Modificar</a>").appendTo(row);
                 if (record.EdoPerfil == 1) {
                    $("<td />").html("<input class='"+record.IdPerfil+"' type='checkbox' checked/>").appendTo(row);
                    row.css("backgroundColor","#bbf2b5");
                 } else {
                      $("<td />").html("<input class='"+record.IdPerfil+"' type='checkbox' />").appendTo(row);
                      row.css("backgroundColor","#fcbfc4");
                 }
                 row.appendTo("#rBuscarPerfil");
            });
       } else {
             $('#errorSearchProfile').html("No se han encontrado resultados para: <b>"+termSearch+"</b>").css("color","red");
       }
  }

});

And when the user check in any checkbox in table, will execute a instruction from change background to row (green if is checked and red if is unchecked) then will execute another function ajax to update record in database and more.. but what interests me most is knowing how to listen to each checkbox to execute an instruction.

I hope can help me please!

  • 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-07T20:11:50+00:00Added an answer on June 7, 2026 at 8:11 pm

    Just put a delegate for click on your table #rBuscarPerfil. Since you’re creating the rows dynamically. Any events you create on the rows themselves (before they are created) won’t work.

    Demo: http://jsfiddle.net/ThinkingStiff/Y355x/

    Script

    $( '#rBuscarPerfil' ).on( 'click', 'input[type="checkbox"]', function() {
        $( this ).closest( 'tr' ).toggleClass( 'green' );
    });​
    

    HTML

    <table id="rBuscarPerfil">
        <tr class="green"><td>1</td><td><input class="1" type="checkbox" checked/></td></tr>
        <tr><td>2</td><td><input class="1" type="checkbox"/></td></tr>
        <tr class="green"><td>3</td><td><input class="1" type="checkbox" checked/></td></tr>
    </table>​
    

    CSS

    tr {
        background-color: red;
    }
    
    .green {
        background-color: green !important;
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this statement will generate a 4 column table: SELECT shipped.badguy AS badguy, shipped.sdate AS
In a View, code like this will generate the right URL to jump to
I have this table in which I am able to generate rows for through
This is from a sql script. What tool can generate this? Thanks --USE [MY_TABLE]
I need to generate Entities/Object from selected tables - not all. Is this possible
I want to generate this SQL statement in LINQ: select * from Foo where
This below codes give me error below: How to generate this codes help me
Isn't visual studio supposed to automatically generate this file for each webservice creation ?
Why when use Youtube-dl on linux ubuntu server many link generate this output? [youtube]
Can anyone tell me why this would generate a syntax error in Safari and

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.