i have a textarea and beside it are two buttons: "add another textarea" and "delete this textarea"
here is my html code:
<div id="summaryIn">
<label for="">Summary of Experience:</label>
<textarea class="TA1" name="mySummary[]" value=""></textarea>
<button class="adddel" name="cmdDelSummary[]" id="cmdDelSummary" title="Delete this Summary" onClick="DelSummary('summaryIn');">-</button>
<button class="adddel" id="cmdAddSummary" title="Add Another Summary" onClick="AddSummary('summaryIn');">+</button>
</div>
my javascript function for adding the textarea works fine, however the delete button doesn't work well, here is the javascript code:
function DelSummary(divName){
alert(summary_counter);
if (summary_counter == 1)
{
document.getElementById('cmdDelSummary').disabled=true;
}
else
{
summaryIn.removeChild(summaryIn.lastChild);
summary_counter--;
//alert(summary_counter);
}
}
i've been trying to figure this out for quite a long time now, but until now i haven't found any solution. . .i don't know how to index/reference the additional delete buttons so that the removeChild would delete that particular textarea only and not always the lastChild..thanks very much in advance :)
summaryIndefined?