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

135
Vistas
How to change icon on AJAX results search by id

I have multiple icons, I want to change my certain icon to another icon based on the ajax result. For example, when the res = true, my bookmark icon needs to change to fa fa-address-card icon. Now the code is when the res = true, both icon will change. Does anyone know how to solve it? Thanks in advance.

<i id="bookmark" class="fa fa-bookmark"></i>
<i id="database" class="fa fa-database"></i>


$('i').removeClass('fa-bookmark');
$('i').addClass('fa fa-address-card');
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

your second jquery line is causing the problem

in both jquery selectors you are selecting all i tags in your html,,

first one isn't causing any trouble because it HAS 'fa-bookmark' and others don't so it will remove bookmark icon class

but in the second one you are applying fa-address-card to all i elements and that's why other icons are getting changed

$('#bookmark').removeClass('fa-bookmark').addClass('fa-address-card');

this is a better approach and will solve your problem

over 4 years ago · Santiago Trujillo 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