seanrf123 seanrf123 - 4 months ago 10
HTML Question

Add settimeout between my get ellements inside one function

I need to add a settimeout between the get elements not sure how to set this out can anyone help

<p id="demo" >Click me to change my HTML content (innerHTML).</p>

<p id="emo" >Click me to change my HTML content (innerHTML).</p>

<button id="addto4" style="display:none;" onclick="myFunction()">change</buton>

<button id="addto3" onclick="myFunction1()">change2</buton>

<button type="button" class="btn btn-default" onclick="myFunction2()">Add all</button>

<script> function myFunction2() {
document.getElementById('addto4').click(); } </script>


You need to split your method in 2 and call the 2nd part after the timeout.

function f2(){

function f1(){
  setTimeout(f2, 3000);