Event is not triggered in Safari mobile

Asked

Viewed 20 times

0

I have this div in my Html, when clicked, opens the file explorer, through the Plupload, to upload a pdf:

<div @(Convert.ToInt32(documento.CodDocumento) > 0 ? "style=display:none" : "") class="ui compact icon button green btn-enviar-arquivos btn-doc-obrigatorio" id="[email protected]" onclick="void(0);" tabindex="0" title="Anexar">
  <i class="upload icon"></i>
</div>

The class btn-enviar-arquivos is used by Plupload as the listener to open the exploited OS files. And the class btn-doc-obrigatorio is used as a click listener to perform some actions:

$(document).on('click', '.btn-doc-obrigatorio', function (e) {
  e.preventDefault();
  var tipo = $(this).closest('tr').find('td[data-tipo]').text();
  $('#hdnCodTipoDoc').val(tipo);
  $('#hdnTipoDocObrigatorio').val(1);
});

All of this works perfectly on all browsers, including Safari. However, the class event listener btn-doc-obrigatorio is not fired in Safari in mobile version. What may be happening for it not to be shot only in this environment?

  • Because the div has this onclick="void(0);"? You’ve tested without it?

  • I already tested yes. I used it for the fact that several places advise to put this onclick="void(0)" on account of Safari mobile

1 answer

0

I solved the problem by creating a div Dad, and then I moved the class btn-doc-obrigatorio, responsible for shooting the event, for the new div.

<div class="btn-doc-obrigatorio">
  <div @(Convert.ToInt32(documento.CodDocumento) > 0 ? "style=display:none" : "") class="ui compact icon button green btn-enviar-arquivos" id="[email protected]" onclick="void(0);" tabindex="0" title="Anexar">
    <i class="upload icon"></i>
  </div>
</div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.