WebAIM - Web Accessibility In Mind

E-mail List Archives

Submitting forms via javascript: Button vs. link vs. other?

for

From: D A
Date: Dec 3, 2009 3:54PM


Assuming Javascript is enabled (I know that, itself, can be an
accessibility issue) what are the pros/cons of using various elements
to act as the trigger for submission?

We could use a button, anchor tag, or span.

What I've come up with:

button: pro - it's a form. A button makes sense in the traditional
sense; con - they can be a pain to style

anchor tag : pro - being a link, it makes sense as a 'clickable'
object; Con - submitting a form isn't the same as clicking a link.
Perhaps this is in appropriate and potentially an issue with indexing
spiders and the like.

span (or other neutral element): pro - easy to style and doesn't have
the cons of the above; con - is there one?

Thoughts? Am I overthinking this?

-DA