Re: Question about buttons

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,

Received on Sunday, 19 June 2005 11:12:18 UTC