0
I have a form that does an update.
But I wanted to put a checkbox input that when checked, changed the action of my form to delete.
0
I have a form that does an update.
But I wanted to put a checkbox input that when checked, changed the action of my form to delete.
5
The simplest way to get this result:
function suaFuncao(option) {
if (option) {
document.getElementById("seu_form").action = "delete";
} else {
document.getElementById("seu_form").action = "update";
}
}
<form id="seu_form" action="update">
Deseja fazer um delete?<input type="checkbox" onclick="suaFuncao(this.checked)">
</form>
It worked as I needed it. I thought it would be complicated and you did it with a few lines. Thanks.
Browser other questions tagged javascript
You are not signed in. Login or sign up in order to post.
I changed your question, I had a lot of information not needed in my view, if you feel that I changed the meaning of your question, just click here and click reverse
– MarceloBoni