hey guys.


$(".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();
            if($(this).val() == "")

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






but got [object Object] in the text box.


Recommended Answers

All 3 Replies

Oh how I wish you had included the HTML as well, instead of me typing a mock table with input fields! :(

sorry :s


    <table class="guests-name" id="guest-name">
                <th>Guest Name</th>
        <tbody  class="guests" id="guestsN">



<table class="tables" id="tables">
     <tbody class="table-body" id="tbl-body">

this worked.

var name = $(this).clone().text();


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.