jquery: assigning event from string
<p>I'm using ASP.net and it creates a pager for a gridview that has the following HTML:</p>

<pre><code>&lt;td&gt;&lt;a href="javascript:__doPostBack(.....)" class="MyLink"&gt;pagenumber&lt;/a&gt;&lt;/td&gt;
</code></pre>

<p>The problem is that when the user clicks on the cell but not the actual content of the cell, the script doesn't trigger because it's not linked to the whole cell.</p>

<p>So I'm writing a small script to extract the link and assign its value to a click event handler for each cell. This is what I have so far:</p>

<pre><code>    $('.MyLink').each(function () {

        var TheLink = $(this).attr('href');
        var CellContent = $(this).html();
       // alert(CellContent);

        var LinkExtract = TheLink.split(":");
        //alert(LinkExtract[1]);

        var PagerCell = $(this).parent();

        $(PagerCell).click(function () { LinkExtract[1]; }); //problem here
        $(PagerCell).html('');
        $(PagerCell).html(CellContent);

    });
</code></pre>

<p>Both alerts return the expected content. However, the click event doesn't work.</p>

<p>Any idea why?</p>

<p>Thanks.</p>
