Atom Ant Atom Ant - 8 months ago 28
Javascript Question

Select a table cell element and submit it in a form

I have a table that is dynamically generated with jQuery, it has 3

cells, with 10 values (returned by the server) in each cell. I want to select one of those values and submit it as part of a form. How should I do this?


Put each value inside those td's in a span and give the td's a class. You could put each value in a different hidden field, on click.

$("td.col1 span").click(function ()){

<input type="hidden" name="var1" id="var1"/>

And then subit the form when 3 are selected.


if(var1 != "" && var2 != "" && var3 != ""){