07-24-2023, 06:24 AM
I want to make button that removes div where button is located.
This current solution removes current div only temporary, BUT i want it completely be removed from this html file. Is that possible?
I am done so far:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" media="screen" type="text/css" href="styles.css"/>
<title>Orders</title>
<center>
<style>
div
{width:797px;
border:2px solid;
background-color:white;
text-align:left;
margin-bottom:2px;}
</style>
<script type="text/javascript">
function deleteline(buttonObj)
{
var node = buttonObj;
do
{
node = node.parentNode;
}
while
(node.nodeType != 1 && node.nodeName != 'div');
node.parentNode.removeChild(node);
}
</script>
</head>
<center><a href=panel.html>back</a></center>
<div>
<input type="button" onclick="deleteline(this)" value="Remove this DIV" />
</div>
This current solution removes current div only temporary, BUT i want it completely be removed from this html file. Is that possible?
I am done so far:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" media="screen" type="text/css" href="styles.css"/>
<title>Orders</title>
<center>
<style>
div
{width:797px;
border:2px solid;
background-color:white;
text-align:left;
margin-bottom:2px;}
</style>
<script type="text/javascript">
function deleteline(buttonObj)
{
var node = buttonObj;
do
{
node = node.parentNode;
}
while
(node.nodeType != 1 && node.nodeName != 'div');
node.parentNode.removeChild(node);
}
</script>
</head>
<center><a href=panel.html>back</a></center>
<div>
<input type="button" onclick="deleteline(this)" value="Remove this DIV" />
</div>