remove my append element when click on button
<script type="text/javascript">
$(document).ready(function () {
$("#fieldset1-add-phoneno").click(function () {
var addphonenoinfieldset = $(document.createElement('div'))
.attr("id", 'fieldset1-inner-phoneno');
addphonenoinfieldset.after().html('<label>phone no : </label>' +
'<input type="text" name="textbox" id="textbox" value="" >' +
'<button class="btn btn-danger"
id="fieldset1-remove">remove</button>' +
'<br>' +
'<br>');
addphonenoinfieldset.appendTo("#fieldset1-outer-phoneno");
});
$("#fieldset1-add-phoneno").on("click", "#fieldset1-remove", function
() {
$("div#fieldset1-outer-phoneno").empty();
});
});
</script>
this is my code and i want to use button id which was written in append
command to remove all appends.....
thanks....
No comments:
Post a Comment