fares says:
$(
"body"
).on(
"click"
,
"[src*=plus]"
,
function
() {
$(
this
).closest(
"tr"
).after(
"<tr><td></td><td colspan = '999'>"
+ $(
this
).next().html() +
"</td></tr>"
)
$(
this
).attr(
"src"
,
"Images/minus.png"
);
});
$(
"body"
).on(
"click"
,
"[src*=minus]"
,
function
() {
$(
this
).attr(
"src"
,
"Images/plus.png"
);
$(
this
).closest(
"tr"
).next().remove();
});
Change with the below code.
<script type="text/javascript">
$("body").on("click", "[src*=plus]", function () {
$("[src*=minus]").each(function () {
$(this).closest("tr").next().remove();
$(this).attr("src", "images/plus.png");
});
$(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
$(this).attr("src", "images/minus.png");
});
$("body").on("click", "[src*=minus]", function () {
$(this).attr("src", "images/plus.png");
$(this).closest("tr").next().remove();
});
</script>