0

I have a code

var el = document.getElementsByClassName('fullscreen-button')[0];
el.click();

It works in chrome, firefox but el.click() doesnot work in ie11. (I am getting the expected el in ie11 so getElementsByClassName is working fine in all browsers).

1 Answers1

0

I suggest you make a test with the code below.

<!DOCTYPE html>
<html>
<body>

<button class="fullscreen-button" onclick="abc()">Full screen</button>


<script>
  var x = document.getElementsByClassName("fullscreen-button");
  x[0].click();

function abc()
{
 console.log("button clicked...");
}
</script>

</body>
</html>

Output in IE 11 browser:

enter image description here

Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19
  • If you think that the above suggestion can help to fix your issue then I suggest you mark the helpful suggestion as an answer. It can help other community members in the future in similar kinds of issues. Thanks for your understanding. – Deepak-MSFT Apr 16 '20 at 09:40