On Jul 9, 5:20 am, Karl Swedberg <k...@englishrules.com> wrote: > On Jul 8, 2009, at 11:47 AM, MorningZ wrote: > > > I see this (stopping links in their tracks) a lot and it's puzzling, > > so i think: > > > *if you do not want an <a> to actually follow a link, then don't use > > an <a>, use a <span> or something instead and use CSS to make it look > > like a link to the user* > > > That will 100% solve all issues with a hyperlink acting like, well, a > > hyperlink :-) > > The problem with using a <span> in those cases is that it isn't > accessible. Links can be focused. You can tab to them and press Enter/ > Return, and the click event will fire. Not so with spans. >
The HTML 4.01 <button> element with type="button" (or <input type="button"> if you don't need anything more than basic text content) is specifically intended for just this kind of thing: <http://www.w3.org/TR/html401/interact/forms.html#edef-BUTTON> <http://www.w3.org/TR/html401/interact/forms.html#h-17.4.1> Focusable, accessible, and doesn't have any default behaviour which has to be overridden. If you don't like the fact that it looks like a button, just style it with CSS: all browsers that JQuery supports allow this. (But remember to set "overflow: visible;" in the styling, or IE6 (as usual) can make a mess of it if it under certain circumstances: <http://natbat.net/2009/Jun/10/styling-buttons-as-links/ >.) Regards, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/