javascript api user web page code
<p>I have Js code that contain Jsonp api functions from my site. Where ever this Js Src code got writed i got to check first if the "api tag" printed already in the page , if it did > execute the api function , if it didn't wait for the tag to get printed in the page and then execute the api Jsonp functions. </p>

<p>for example i have this code</p>

<pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;!-- js code - contain Jsonp functions --&gt;
    &lt;script type="text/javascript" src="jsonp.js"&gt;&lt;/script&gt;
  &lt;/head&gt;

  &lt;body&gt;
    &lt;!-- when this newtag get print , the function starts --&gt;
    &lt;newtag:api size="small"&gt;myNewTag&lt;/newtag:api&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>I don't know where the user will decide to put the JS code , it may be in the head , body or in the middle of the page , since i have this mystery i cant do something like this :</p>

<pre><code>&lt;newtag:api size="small"&gt;myNewTag&lt;/newtag:api&gt;
&lt;script&gt; startJsonp(); &lt;/script&gt;
</code></pre>

<p>because if the js code did not printed yet the order will not be execute.</p>

<ul>
<li><p>if the code got print in the head it will not work since the "api tag" did not got printed yet.</p></li>
<li><p>to make the api work i need the "api tag" to be printed on the screen already for the Jsonp functions to work.</p></li>
</ul>

<p>what else i can do to solve this?</p>
