I want to create a login form on a single HTML page to display with JQuery (I am new to the technology).
I am wondering whether I should use a <div> and hide/display it, or use a <form> and hide/display it. The info will be sent to a servlet with Ajax.
If I use a <div>, what should I use as a substitute for <input> available in forms?
If I use a <form>, I believe I have to provide an action, which is annoying, since I use a single page. Is there a way to dodge this issue?
What is the recommended login method to use in this case, <div> or <form>?
You should use the
<form>tag because it is semantically correct (the users are filling out a login form).You can let
action=""on the form, and prevent the form from trying to submit with theonsubmitproperty: