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

106
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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