Issue
I need a way for all these functions to combine to make it into one
<a> <input> <button> <confirm>
one by one
Flask
<a href="{{ url_for('products.delete', id=product.cod) }}" >Delete</a>
Flask button
<input type="button" value="Delete">
JS script
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
let text;
if (confirm("Press a button!") == true) {
text = "You pressed OK!";
} else {
text = "You canceled!";
}
document.getElementById("demo").innerHTML = text;
}
</script>
I need a function that do all of this.
Solution
The solution
<a href="{{ url_for('productos.delete', id=producto.codprod) }}" onclick="return confirm('Are you sure?')">Delete</a>
and the button style
option 1
<a
href="{{ url_for('productos.delete', id=producto.codprod) }}"
onclick="return confirm('Are you sure?')"
type="button"
style="text-decoration: none;
min-width: 100px;
max-height: 30px;
background-color: #224a64;
color: #fff;
text-align: center;
border-radius: 6px;
cursor: pointer;
right: 0px;
"
>Eliminar
</a>
option 2
<a href="{{ url_for('productos.delete', id=producto.codprod) }}" onclick="return confirm('Are you sure?')"><input type="button" value="Eliminar"></a>
Answered By - ROnaaLd Dariio
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.