How to get an the text value of an element in jQuery?
<p>I have an HTML table generated dynamically with field names generated for each row  dynamically as well.</p>

<p>Here is the structure I have within the table. I have a <code>&lt;td&gt;</code> tag and within it I have a <code>&lt;span&gt;</code> tag. I want to get the value for each tag. I have tried this this way:</p>

<pre><code>$("#txtname").attr('value',$("#table1").find('td &gt; #selname_'+i).text());
</code></pre>

<p>In the above code I am setting the <code>$("#txtname")</code> (textbox value) with the value from the <code>&lt;span&gt;</code> tag (selname). Here <code>i</code> is an incrementing value. </p>

<p>I want to get the text, but do not get the <code>&lt;span&gt;</code> value, and I am not able to assign to it.</p>
