0

A boog noob Alert!...I've html div like this

<div class="col mt-2">
<button @click="selected = Array.from(header); render()" class="btn btn-light-alt btn-sm">Select all</button>
<button @click="selected = []" class="btn btn-light-alt btn-sm">Clear selection</button></div>
    

All I want to do is click on this Select all button after 5 seconds webpage is loaded. I've searched for this way to do it & I found this

setTimeout(document.getElementByID('button').click(),5000);

I think button is Id here???...But there is no Id in my html tag...we can see only class is available...so can I achieve this requirement?...Any similar threads that you guys know?

1 Answers1

0

If you can't modify the HTML, and that button's function is always the same, then you don't actually need to trigger the click. Just run the functions.

setTimeout(function(){
   selected = Array.from(header);
   render();
},5000);
imvain2
  • 15,480
  • 1
  • 16
  • 21