Jump to content

g3t

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by g3t

  1. Hi

     

    Im needing to fire a function when an ID is added to some html. The application has 3 steps and unfortunatly doesn have anything clear that defines the step in the html so the only way to detect this is acouple of IDs that are added for each step. So i have this js that uses a setTimeout to run the function until the ID is added.

    function thirdFire() {    if (document.getElementById("localPayment_content")){    var div2 = document.createElement("div");div2.style.width = "100px";div2.style.height = "100px";div2.style.background = "blue";div2.style.color = "white";div2.innerHTML = "form";document.getElementById("localPayment_content").appendChild(div2);alert("SECOND");            } else {        clearTimeout(function() { thirdFire(); }, 1000);    }}setTimeout(function() { thirdFire(); }, 1000); 

    But it means that i will have to create this for each step but doesn't always work for the other steps. Also have read not good to use this as it running in the background constantly. I have read abit about mutation events but cant figure this out to work for this situation. Any help much appreciated.

×
×
  • Create New...