jquery - How to get clone html hidden id while clicks on cancel button -
i have clone html data here need delete 1 record need id cancel record. here html code: <div id="allergies" class="clone"> <div class="copy"> <input type="hidden" id="allergyid" value=""> /*rest of code html data*/ <a class="addallergy" id="addallergy">save , add allergy</a> <a class="removeallergy" id="removeallergy">cancel</a> </div> <div> here javascript code: var p=$('.copy').length; var h=0; for(var i=0 ; i<data.allergies.length ; i++){ var cloned = $(".copy:first").clone(true) . .appendto('#allergies').addclass("childallergyclass" + (i + 1)); $(".childallergyclass"+ ++h+" #allergyid").val(data.allergies[i].allergyid); } now html code be: <div...