Retrieving a table cell's text once clicked in jQuery
<p>I've been having some trouble retrieving text of a table cell that is clicked, the only way I can get the event to fire is substituting "tbody td" with </p>

<pre><code>$("body").click(function(e) {
</code></pre>

<p>but this does not return correct data value for cell clicked. Anyone know what I might be doing wrong? I need to create the table using jQuery so it can be dynamically sized based on input given from a form.</p>

<pre><code>$(document).ready(function() {
    $('#selection').submit(function() {
        $(function () {

            var $tbl = $('&lt;table border="1"&gt;').attr('id', 'table');
            var $tbody = $('&lt;tbody&gt;').attr('id', 'tableBody');

            for (var i = 0; i &lt; $("#numOfPieces").val(); i++) {
                var trow = $("&lt;tr&gt;"); // New row

                for (var j = 0; j &lt; $("#numOfPieces").val(); j++) {
                    $("&lt;td&gt;")
                            .text('Row : ' + i + ', Col: ' + j)
                            .appendTo(trow); // New data cell
                }
                trow.appendTo($tbody);
            }

            $tbl.append($tbody);
            $('table').remove(); // Remove previously created table
            $('body').append($tbl);
        });
        return false;
    });

    $("tbody td").click(function(e) {
        var currentCellText = $(this).text();
        var LeftCellText = $(this).prev().text();
        alert(currentCellText);
    });
});
</code></pre>
