WebAIM - Web Accessibility In Mind

E-mail List Archives

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

for

From: Stephan Wehner
Date: Dec 3, 2009 4:15PM


On Thu, Dec 3, 2009 at 2:54 PM, D A < <EMAIL REMOVED> > wrote:
> 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?

Are you looking for alternatives to the usual (and fourth option)
<input type="submit" ...>, which is different from <button
type="submit" ...> ... </button>, in order to be able apply more
styling to the button?

Stephan

> Thoughts? Am I overthinking this?
>
> -DA
>