W3C home > Mailing lists > Public > www-validator@w3.org > June 2005

Re: Question about buttons

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Sun, 19 Jun 2005 14:12:10 +0300 (EEST)
To: Abyss <info@abyss.ws>
Cc: www-validator@w3.org
Message-ID: <Pine.GSO.4.58.0506191407230.8285@korppi.cs.tut.fi>

On Sun, 19 Jun 2005, Abyss wrote:

> is a button <input> only allowed inside a form?
> or is it allowed outside of a form?

An <input> element is allowed wherever inline elements are allowed; they
need not be inside a <form> element, since they usually are, for semantic
and functional reasons.

You can check this from the DTDs - or using a validator. :-)

> for it to be xhtml valid

There is not difference between HTML and XHTML in this respect.

> because i have a button that is on a page...
> it validates outside of a form, as it is only calling a JS function.
> is this still valid?

It is valid, but not advisable. If a button works only when JavaScript is
enabled, it is better to _generate_ it with JavaScript dynamically, so
that you avoid a dysfunct button when JavaScript is not enabled.

Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Sunday, 19 June 2005 11:12:18 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:58:51 UTC