Tab focusing using event/focus( fn )
Hi Guys,
It's my first post, nice to meet you all. I've been assigned the task of looking in to the possibility of adding tab focus to a web site i'm working on and I wanted to consider the possibility of using JQuery. I'm relatively new to the scripting language but I am aware of its power.
The closest I can find is the event/focus( fn ) which works well but I wondered if anyone could elaborate on this function for me. I want to be able to tabindex each form element within a page and then use the focus event to focus, or highlight, the selected element - similar to the way Safari focuses on elements with a surrounding blue hue.
Any ideas fellas? I realise I'm asking quite a bit but just wondered if you had any ideas?
Here's the source code for an example using focus( fn )
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
$("input").focus(function () {
$(this).next("span").css('display','inline').fadeOut(1000);
});
});
</script>
<style>span {display:none;}</style>
</head>
<body>
<p><input type="text" /> <span>focus fire</span></p>
<p><input type="password" /> <span>focus fire</span></p>
</body>
</html>