I am using spring mvc in my project.
<form:form method="" action="" id="myform" commandName="users">
I have this form, want to add action a runtime using jquery. how can I do it Using javascript I was doing as which worked fine
document.getElementById("myform").action = "changePWD"
document.getElementById("myform").method="POST";
Using jQuery:
$('#myform').attr('action','changePWD').attr('method','POST');
Why would you not do it with Javascript though if that is working fine as you say?
$('#myform').attr({
action: 'changePWD',
method: 'POST'
});
But I agree with Kokos, why fix what's not broken?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.