how can I change a form's action with prototype ? I've seen plenty of examples with jquery using:
$("#form1").attr("action","http://actionurl.com");
but haven't one with prototype. Thanks in advance.
You can also set onSubmit attribute's value in form tag. You can set its value using Javascript. Remember that onSubmit has higher priority than action attribute. So whenever you specify onSubmit value, that operation will be performed first and then the form will move to action.
form action javascript. In an HTML form, the action attribute is used to indicate where the form's data is sent to when it is submitted. The value of this can be set when the form is created, but at times you might want to set it dynamically.
prop() returns the full action url: To use the action attribute of a form use: $( '#myForm' ). attr( 'action' ); like @JAAulde said.
You could use the writeAttribute method:
$('form1').writeAttribute('action', 'http://actionurl.com');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With