I am using a JavaScript API that creates a complex map and attaches it to a <div> tag hardcoded on my page. This script runs on window.onload. My problem is that I need to modify one of the JavaScript created elements (another <div> tag) once it's created. I've tried to add this script right after the map is initialized, but I guess that element hasn't been downloaded/constructed yet because it doesn't get modified. I know my script is good because I made a hardcoded element on my page to run this script onclick.
Is there a way to create a script that checks to see if this element exists. If it doesn't, check again every X-milliseconds. If it does, run the modification script and don't look for this element again.
Would that even be the right approach?
With the help in another post, my modification script uses jQuery and looks like this:
function modification(){
$("div.gmnoprint").each(function(){
var index_current = parseInt($(this).css("zIndex"), 10);
if(index_current == 10) {$(this).css("margin-top", "91px");}
});
}