JQuery focus function not working mobile

0

I have the following function in my code .js :

element = $('.bloco-pesquisa').find('#inp-pesquisa');

element.focus(function(){
    alert("focus!");
    if (!load_autocomplete){
        $.getScript('/js/jquery.typing-0.2.0.min.js');
        $.getScript('/js/autocomplete.js');
        load_autocomplete = true;
    }
});

In browsers on the computer it works, no longer Chrome or other browser on the tablet / cell phone does not.

Does anyone know where I'm going wrong or some way to make it work?

I've tried using:

.on('click touchstart', function () {

.on('click touch', function () {

.on('click touchend', function () {

None of these options worked.

    
asked by anonymous 10.05.2018 / 14:04

0 answers