views:

99

answers:

2

I have an html table and in one column i have dropdown select. i would like a selector to get a handle to the dropdown in the last row of the table and change it to just regular text (using the value in the select). here is the tricky part, in some cases the last row will not have a dropdown and it will just be text in this cell and in this case i want to do nothing.

so i am need something that supports the following logic:

Get dropdown select in lastrow of table and convert to text. If there is no dropdown in that cell then do nothing.

+1  A: 

Ok, you can just do this, assuming the text you want to replace the select with is in the variable textValue and the table has the id tableid:

$('#tableid tr:last select').replaceWith(textValue)
Glenn Slaven
if it is a dropdown i want to remove the dropdown and replace it with regular text in that cell
ooo
You might want to go change this question to ask that instead, then I can just post the above solution, it will be much clearer for other people with the same problem :)
Glenn Slaven
i updated the question
ooo
Glenn Slaven
A: 

how to automaticalyy select the last added value to dropdown using c# code

rathan rosai