Getting the value of an element in jQuery
<p>My code is working good thanks to the help of members here. Now I have one last step / request. I have the following code that some may have seen before just in the last hour:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    $(document).ready(function () {
        $("[id^=topic]").change(function () {
            var a = 'pk' + $(this).attr('id').replace('topic', '');
            var b = $(a).val()
            alert(b);
        });
    });
&lt;/script&gt;
</code></pre>

<p>and then later on:</p>

<pre><code>&lt;td id='pk_1'&gt;Cat&lt;/td&gt;
&lt;td id='pk_2'&gt;Dog&lt;/td&gt;   
</code></pre>

<p>This code picks out pk_1, pk_2 etc and places into the variable named "a". What I would like is not to get the value of the element pk_1. I tried some different ways of getting this and putting into "b". For example I added "#". None work. Sometimes the alert box shows the word "undefined" sometime nothing. Anyone have any suggestions?</p>

<p>Thank you all</p>
