I have a table I’m trying to derive a JSON object from using the below code
var tbl = $('#myTable tr:has(td)').map(function(i,v){
var $td = $('td', this);
return{
id:$td.eq(0).text(),
column1:$td.eq(1).text(),
column2:$td.eq(2).text()
}
}).get();
This works perfect except from one thing, I sometime have a textbox or checkbox inside a td whose value I need to retrieve. I’ve Google’d and searched StackOverflow but I could not find any that worked in this situation
I have also tried the follow with no luck
id:$td.eq(0).val()
id:$td.eq(0).childern().val()
any suggestions or advice would be greatly appreciated
You’ll probably want to
findthe input if its something like a textbox:for a checkbox, use the pseudo-selector
:checkboxand determine itscheckedproperty