Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
How can I attach event handlers to elements appended to DOM?
$(document).ready(function() {
    $.ajax({
        url: 'php/sql/getPlaylists.php',
        type: 'GET',
        success: function(result) {
            let data = $.parseJSON(result);

            let contenido = "";

            $.each(data, function(index, value) {
                contenido += "<div class='col-3 my-3 overflow-hidden'> ";
                contenido +=
                    "<div class='card shadow-40 m-4' style='width: 350px !important; '>";

                contenido += "<img class='card-img-top' src='uploads/fotos/" + value.foto +
                    "' alt='Card Image' height='250px'> ";
                contenido += "<div class='card-body'> ";

                contenido += "<h6 class='card-title'>";
                contenido += value.nombre;
                contenido += "</h6>";
                contenido += "<a directorio='php/routes/verplaylist.php?id=" + value.id +
                    "' class='routing btn btn-primary'>Ver</a>";

                contenido += "</div>";
                contenido += "</div>";
                contenido += "</div>";
            });
            $('#lista-datos').append(contenido);
            

        },

    });
});

I'm trying to add click function when click these a elements but it doesn't detect them, I tried before with an not apended item and it worked, but it's not the same with these ones.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!