I Have A Row From A Html Table In The Form : $(row).text(). How Do I Feed This Into A Input Type="hidden" Element
I have two html tables: stockdataTable which gets its data from a database call. result table which is empty initially and dynamically has rows appended to it when a user clicks a
Solution 1:
Check this out:
var row
$(document).ready(function () {
$("#tabs").tabs();
$('#stockdataTable tr').click(function (event) {
row = $(this).clone();
$('#resultTable').append(row);
$("#resultTable").on("append", "tr", function () {
alert($(this) + " was added");
}, function () {
alert($(this) + " was removed");
});
$(row).click(function (event) {
var row = $(this).text().replace(/ /g,''); // replace whitespaces
$(this).remove();
reg(row); // call to reg function
});
});
});
functionreg(text) {
alert(text);
$('#tradeDetail').val(text);
returntrue
}
You need to declare a function with arguments, and then call it when you need. I change $('#tradeDetail').val(text)
because you miss #
. Note that $(this).remove()
is moved after reading his properties, otherwise you can't get the text if it's removed.
Post a Comment for "I Have A Row From A Html Table In The Form : $(row).text(). How Do I Feed This Into A Input Type="hidden" Element"