javascripthtmlajaxformssingle-page-application

Single page applications and <form> elements


Are there still any benefits of using a <form> element instead of let's say a <div> element in the context of a single page application? The purpose of the <form> element makes sense to me if the "form" submission isn't made with an ajax call (I'm talking about the more traditional way of submitting a form, with a input/button of type "submit" and the action attribute of the form element that describes the url to call), but otherwise I do not see it's utility (maybe for search engines?).


Solution

    1. Semantically, using <form> is clearer than <div>.
    2. If you still want your form to work without JavaScript, you'd better choose <form> (since you used the word application, this may not be considered though).
    3. More importantly, it'll be really painful of using <div> if you do care about accessibility.