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

144
Vistas
click on img using jquery not working on mobile

i have following code

$('.radio-color').click(function () {
                            $('.radio-color').removeClass('selected');
                            $(this).addClass('selected');
                            var color = $(this).attr('value');
                            //alert('<input type="hidden" name="color" value="'+color+'">');
                            $('#product_color').val(color);
                            $('#h4_color').text('\u00A0' + color);
                            var id = $(this).attr('id');
                            $('.flex-control-thumbs ').find("li:eq("+id+")").find('img').click();
                        });

everything is working fine on PC but the last statement is not working on mobile. which is:

$('.flex-control-thumbs ').find("li:eq("+id+")").find('img').click();

i have tried using touchstart, touchend etc options but none have worked for me so far. i am stuck on it for 3 days now. need immediate help.

thanks in advance

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Maybe try something like this?

var img = $('.flex-control-thumbs ').find("li:eq("+id+")").find('img');
$(img).trigger("click");
about 4 years ago · Santiago Trujillo Denunciar

0

Is it IOS you're having trouble with? I've been having trouble registering clicks in IOS myself. Apparently they don't allow that. There's a stack overflow answer somewhere that links to an IBM article explaining that.

One thing you can try doing is remove the ".click()" with something like ".remove()", just to make sure the element is being targeted correctly (maybe some mobile media query is shifting things around?)

Worst case scenario, can you replicate your click function without actually clicking the element?

Another thing you can try: Somewhere in your code, there must be a click function assigned to that element, right? Something like:

$('.the-element').on('click', function(){});

Try replacing that with

$('.the-element').on('click newTrigger', function(){});

Then in your code above, replace

$('.flex-control-thumbs ').find("li:eq("+id+")").find('img').click();

With

$('.flex-control-thumbs ').find("li:eq("+id+")").find('img').trigger('newTrigger');

I also see adding cursor: pointer; in CSS works for some people on the element to be clicked.

about 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