Skip to content Skip to sidebar Skip to footer

Cloned Item When Clicked To , Gets Back To Original Form But Doesn't Get Removed

I cloned a row of elements. After cloned, the original textbox element is replaced with link. Then if users choose to remove the cloned item, it gets back to original place in orig

Solution 1:

Finally, I found the answer by myself. The usage of $(this) is solved my problem.

function removeThis(param)
{
     event.preventDefault(); 

     $("div.clone_this#"+param).detach().appendTo("#sub");
     var price = $("a[href=ch]").text();
     $(this).find($("#sub a[href=ch]").text(price)).replaceWith("<input type='text' onfocusout='getText("+param+")' class='text_"+param+"' val='"+price+"' placeholder='RM'>");
    $("div.clone_this#"+param).find("a[href=del]").remove();
     return false;
}

Post a Comment for "Cloned Item When Clicked To , Gets Back To Original Form But Doesn't Get Removed"