Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between action and target of post?

I looked for attribute of form on W3S - HTML Forms page and I saw that, there are two similar attributes, at least I suppose that. I don't understand differences between them. So I want to ask, What is the difference between action and target of post?

like image 829
Kamuran Sönecek Avatar asked Aug 11 '15 07:08

Kamuran Sönecek


1 Answers

action is where the data is sent, target is which window (or tab, frame, iframe) to use for the request. If action is omitted, it assumed to be the current page (the same URL). If target is omitted, it is assumed to be the same window (or tab).

Using target="_blank" always opens in a new window (or tab, frame, iframe). You can use a name for the window so that all links/forms with target="karl" would always open in the same window or tab.

This is the actual (current) HTML5 standard information on the form element: http://www.w3.org/TR/2014/REC-html5-20141028/forms.html#the-form-element

like image 187
Karl Wilbur Avatar answered Sep 30 '22 15:09

Karl Wilbur