How-to ask user to to verify or accept to remove content of div

In this example we learn how to clear div content editable with button after ask user to verify or accept to remove content of div
<style>
#content {
width: 98%;
height: 300px;
box-shadow: 0 0 3px 0 #545454;
padding: 5px;
border-radius: 3px;
}
#content:focus-visible {
box-shadow: 0 0 5px 3px #00b0ff;
border: 1px solid #0090a2;
outline: 0;
}
</style>
<button onclick="return confirm_delete('Are you sure?')">
Clear
</button>

<div id="content" contenteditable="true">write text here and try to remove it</div>

<script type="text/javascript">
function confirm_delete(question) {
if(confirm(question)){
document.getElementById("content").innerHTML="";
}else{
return false;
}

}
</script>
How-to ask user to to verify or accept to remove content of div

© 2025 Manajmnt code

Share to :

Related

Comments