samedi 10 février 2018

Safari returns an error on document.getElementById(id).click();

I was checking the compatibility of my web application in different browsers, and I found out Safari has a problem that other browsers doesn't have. I think it must be something that is not supported in Safari

In my code I just wrote this line because I wanted a button that displays some content to be clicked on page load.

<script>document.getElementById("openIfRegistered").click();</script>

I can't understand why it works in other browsers, but not in Safari. Is there a compatibility problem? If so, is there a way to solve it?

This is the error i receive

TypeError: 'undefined' is not a function (evaluating 'document.getElementById("openIfRegistered").click()')




Aucun commentaire:

Enregistrer un commentaire