0

I have an HTML table generated dynamically with field names generated for each row dynamically as well.

Here is the structure I have within the table. I have a <td> tag and within it I have a <span> tag. I want to get the value for each tag. I have tried this this way:

$("#txtname").attr('value',$("#table1").find('td > #selname_'+i).text()); 

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

I want to get the text, but do not get the <span> value, and I am not able to assign to it.

2
  • stackoverflow.com/questions/3331580/… Commented Jul 26, 2010 at 21:31
  • Please do not re-post questions. Instead, edit your original question if you have additions or clarifications. Re-posting wastes your time and ours. Commented Jul 26, 2010 at 21:36

1 Answer 1

1

No need to make your selectors so complicated:

$("#txtname").val($("#selname_"+i).text()); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.