Reputation: 11911
I have a bunch of <input type="text">
.Is it valid to put them in a <div>
and not <form>
? I'm asking because I have <button>
s there too, that need to do some functionality, and clicking on them causes jsfiddle's:
{"error": "Please use POST request"}
Adding e.preventDefault()
fixes the problem, but I still wonder if replacing <form>
with <div>
is OK?
Thanks.
Upvotes: 1
Views: 2396
Reputation: 943250
It is valid but violates the principles of unobtrusive JavaScript, introduces accessibility issues and removes useful APIs.
Having a form:
form.elements
and similar APIs for accessing controls simply (including for such things as jQuery's serialize
method).Upvotes: 2