adding functions to injected elements
<p>Okay how can i add function to injected elements(which that element dosent exist on first browser load). Please read through my example carefully , i hope you can understand.</p>

<p>For example:
i go to www.website.com , when it loads it loads up "functions.js" and "other.js" , inside "functions.js" there's a code that injects a new div with ID when user click on a button.</p>

<p>The injection code as shown below:(functions.js --jquery)</p>

<pre><code>$('a#button').click(function(){
    $('a#button').after('&lt;div id="new"&gt;New div&lt;br&gt;&lt;a href="#" id="newdivlink"&gt;Another link&lt;/a&gt;&lt;/div&gt;');
});
</code></pre>

<p>However there's another on click functions loaded in another js file which is "other.js" (loaded same time as function.js load).</p>

<p>Inside "other.js" has the code for the onclick function when the new div's link (#newdivlink) is clicked.</p>

<p>other.js :</p>

<pre><code>$('a#newdivlink').click(function(){
  alert('you clicked on new div's link yay?');
});
</code></pre>

<p>But the problem is , the onclick function for the new div's link(#newdivlink) cant be executed as the script can't find the div (as it is being injected after i loads).
Or is there some problems ?</p>

<p>P/S if you are asking why not combine both scripts , i don't want, as i want to try this technique  out.</p>
