hey guys.
js:
$(".addGuest-btn").live("click", function(){
/*in table2*/
var addG = $(this).parent();
var insert = '<tr><td class="insertG"><input type="text" class="add-name" placeholder="Doubleclick on a name."></td></tr>';
$(addG).append(insert);/*append into table2*/
});
});
$(".guests td").dblclick(function(){
/*table1 td*/
alert("double clicked!");
var name = $(this).clone();
$(".add-name").each(function(){
if($(this).val() == "")
{
$(this).append(name);
}
});
addGuest function works and appends the text box. the other half of the code doesn't run. the alert for double click appears then the rest of the function doesn't run.
i tried changing
$(this).append(name)
to
$(this).val(name);
/*and*/
$(this).append().val(name);
but got [object Object] in the text box.
TIA