alt attribute for input tag

  • Thread starter =?iso-8859-1?Q?Marcel_St=F6r?=
  • Start date
?

=?iso-8859-1?Q?Marcel_St=F6r?=

Hi all,

Why would the browser not produce a nice tooltip saying "hello" if I move
the cursor over the checkbox?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<input name="test" type="checkbox" value="1" alt="hello"/>
</body>
</html>

The code is valid XHTML...

Regards,
Marcel
 
?

=?iso-8859-1?Q?Marcel_St=F6r?=

brucie said:
because its not supposed to. use title="blah"

Hhmm, according the XHTML DTD there is an "alt" attribute for an "input"
tag. However, the spec doesn't talk about titles for input elements...

Regards,
Marcel
 
C

Chris Morris

Marcel Stör said:
Hhmm, according the XHTML DTD there is an "alt" attribute for an "input"
tag. However, the spec doesn't talk about titles for input elements...

title is a 'common' attribute. If you follow the DTD around a bit
it's there.

<input alt="..."> is only used by (some) browsers on <input
type="image"> as far as I know.

Anyway, 'alt' means alternative, so it only gets displayed when the
"primary" isn't. A checkbox can always be displayed by a browser in
the "primary" sense. Exactly what it looks like may vary, obviously.

'title' is for supplementary information, and a lot of popular
graphical browsers do display it on hover.
 
S

Steve Pugh

Marcel Stör said:
Why would the browser not produce a nice tooltip saying "hello" if I move
the cursor over the checkbox?

The purpose of alt attributes is not to create tooltips. The fact that
some browsers do should not be taken as an indication that it will
always happen.
<input name="test" type="checkbox" value="1" alt="hello"/>

The code is valid XHTML...

The alt attribute exists on input for the purpose of providing an
alternative to the input when the input can not be displayed.
In practice this almost always means as an alternative to the image in
<input type="image"> when images can not be displayed.

But there may be circumstances when a browser can't display your
checkbox and would display the alt attribute instead.

title is also a valid attribute of input (and most other elements) and
is intended for additional but unimportant information.
This may be displayed as a tooltip browser or may be made available to
the user in some other way.

If the information is important then you should include it in the page
itself and not rely on browsers that may or may not display a tooltip
under some circumstances.

Steve
 
S

Sid Ismail

: > Brucie! You're back?
:
: no, you're imagining things. go back to sleep and stop taking all the
: blankets.
:
: --
: brucie


He only shows up on Turkey, Guy Fawkes, and Halloween... Hi Brucie!!!

Sid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top