Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change form action with prototype

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.

like image 510
xain Avatar asked Apr 11 '10 14:04

xain


People also ask

How do I change the action of a form in HTML?

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.

What is action in form in JavaScript?

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.

How do I get a form action URL?

prop() returns the full action url: To use the action attribute of a form use: $( '#myForm' ). attr( 'action' ); like @JAAulde said.


1 Answers

You could use the writeAttribute method:

$('form1').writeAttribute('action', 'http://actionurl.com');
like image 168
Darin Dimitrov Avatar answered Sep 30 '22 05:09

Darin Dimitrov