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

202
Views
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
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!