Im пытается удалить текстовое поле равномерно. Я имею в виду для каждого текстового поля я хочу, чтобы удалить Button.If я нажмите кнопку удаления я хочу удалить текстовое полеJQuery Append Html onclick function
Html для добавления несколько текстового поля
<pre><div id="TextBoxDiv1">
<label style="float: none;"> Bus Model
<input style="width: 150px;" type="text" value="" class="validate[required,custom[onlyNumberSp]]" name="numsValid" id="numsValid">
<img src="images/india_rupess.png" style="margin-left:18px;"> :</label>
<input style="width: 150px;" type="text" value="" class="validate[required,custom[onlyNumberSp]]" name="numsValid" id="numsValid">
<label style="float: none;margin-left: 16px;"><span class="font-dollar">﹩</span> :</label>
<input style="width: 150px;" type="text" value="" class="validate[required,custom[onlyNumberSp]]" name="numsValid" id="numsValid">
<a href="javascript:;" id="addButton">Add</a> <a href="javascript:;" id="removeButton">Remove</a>
</div></pre>
Это мой сценарий
<pre>var counter = 2;
$("#addButton").click(function() {
$("#TextBoxesGroup").append('<div id="TextBoxDiv' + counter + '" class="textadd""><label style="float: none;"> Bus Model <input style="width: 150px;margin-left:3px;" type="text" value="" class="validate[required,custom[onlyNumberSp]]" name="bus' + counter + '" id="numsValid"><img src="images/india_rupess.png" style="margin-left:21px;"> :</label><input style="width: 150px;margin-left:3px;" type="text" value="" class="validate[required,custom[onlyNumberSp]]" name="rs' + counter + '" id="numsValid"><label style="float: none;margin-left: 19px;"><span class="font-dollar">﹩</span> :</label><input style="width: 150px;margin-left:2px;" type="text" value="" class="validate[required,custom[onlyNumberSp]]" name="dollar' + counter + '" id="numsValid"> <a href="javascript:;" onClick="javascript:alert("test");" >Remove</a></div>');
counter++;;
});
Нажмите для просмотра http://jsfiddle.net/b8DRT/
что вопрос – Laughing
возможно дубликат http://stackoverflow.com/questions/7315674/javascript-add-remove-textbox -и-соответствующий-delete-button –
это не мой вопрос.Nikko Reyes ответил за это один. –