Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

203
Vistas
How to make a <p> clickable javascript

I currently have this block of code which prints out a list of names associated with a list of people on a team. I am trying to make the text clickable that way you are able to capture the name of the person you clicked and perform an action on a different php file passing the name of the person you clicked. How would I go about doing this

   <script type="text/javascript">
       $(document).ready(function() {
           $("#your_teams234").change(function() {
               var team = $("#your_teams234").val();
               $.ajax({
                   url: 'functions.php',
                   method: 'post',
                   data: 'members=' + team
               }).done(function(requests) {
                   console.log(requests);
                   requests = JSON.parse(requests);
                   $('#teammates').empty();
                   requests.forEach(function(request) {
                       $('#teammates').append('<p class="myDivs">' + request.fname + ' ' + request.lname + '</p>') 
                   })
               })
           })
       })
       
       
   </script>
   <script type="text/javascript">
       $('.myDivs').click(function(){ alert($(this).text()); });
   </script>

What the print looks like

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda