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

104
Views
Jquery alert fire two times instead of once with php

I am working with jquery and php, Right now i have "Edit" button but whenever i am clicking on button i am getting "alert" twice instead of one time, Here is my html code(inside php tag)

<?php
$PostComment2='<div class="button1'.$CommentID.'">
<span  name="MaxValue" value='.$CommentID.' data-val='.$CommentID.' id="MaxValue" class="edit_post_comment">
Edit2
</span></div>';
?>

Here is my script

<script>
      $(document).ready(function(){
      $(document).on('click','.edit_post_comment',function(e){
      e.preventDefault(); 
      alert('Hello world');
      //further code...
    });
}); 
</script>

How can i alert one time only instead of twice,Where i am wrong ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

may you are using the class twice in the body? Please check. You may try using id.

about 4 years ago · Juan Pablo Isaza Report
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!