How do I execute an event using jQuery through an html object(button) created through Javascript?
<p>I'm just new here.  So here's where I'm stuck:</p>

<p>I created an html table using javascript.  I have a button,which when clicked, will create set of tables with exactly the same structure but the objects(eg. button, text) inside those tables have different ID's.  Now when I try to execute a click function using jQuery with a button on one of the produced tables, it won't work.  How do I go around here? Thanks in advance!</p>

<p>Here's a sample function which creates the html table(with unique ID's) in javascript:</p>

<pre><code>function CreateTables() {

    var html = ' ';
    var valPrompt = prompt("How many tables would you like to add?");
    parseInt(valPrompt);
    for (i = 1; i &lt;= valPrompt; i++) {

        html += "&lt;table&gt;" + "&lt;tr&gt;" + "&lt;td&gt;" + "Text goes here" + "&lt;/td&gt;" + "&lt;td&gt;" + "&lt;input type='text' id='txtTEXT" + i + "'/&gt;" + "&lt;/td&gt;" + "&lt;td&gt;" + &lt; input type = 'button'
        id = 'btnALERT" + i + "' / &gt; +"&lt;/td&gt;" + "&lt;/tr&gt;" + "&lt;/table&gt;"
    }
    document.getElementById('HtmlPlaceHolder').innerHTML = html;
}​
</code></pre>

<p>So, if we review the code, Sets of table with buttons(btnALERT) with unique ID's will be created if the function <strong>CreateTables</strong> is executed.  In order to select the objects, I suppose I'll be using jQuery.  So for example, if I bind a handler in btnALERT1(produced by CreateTables) say a click function in order to alert a simple "Hello", how will I do this? My code for this doesn't seem to work:</p>

<pre><code>$(document).ready(function() {
    $('#btnALERT1').click(function() {
        alert("Hello");
    });
});​
</code></pre>
