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

142
Vistas
prev().remove(); is not applying to the previous sibling

I've created li elements and after every li elements there is a div of class crossSign which contains two rectangles making a cross. I want it to when clicked remove it's previous sibling and remove the cross itself. But it's not working when clicked. Can someone tell me what is the problem. And i can't give the html or the css cause im afraid if someone copy it.

    $newform.on('submit', function(e) {
    e.preventDefault();
    var text = $newform.find('input:text').val();
    var url = document.getElementById('addurl').value;
    $list.append('<a href="'+ url +'"><li class="links"><span>' + text +'</span></li></a>');
    $list.append('<div class="crossSign"><div class="line1"></div><div class="line2"></div></div>');
    //$('a').attr('href', url);
    $newform.find('input:text').val('');
    $addurl.val('');
});
$('#close-form').on('click', function() {
    $newform.hide();
    $newlinks.show();
});
$('.crossSign').on('click', function() {
    $(this).prev().remove();
    $(this).remove();
});
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