WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: Focus on heading, span, paragraph tags

for

Number of posts in this thread: 1 (In chronological order)

From: Rakesh
Date: Mon, Oct 14 2013 10:24AM
Subject: Focus on heading, span, paragraph tags
No previous message | No next message

All,
To contribute best to my blog http://www.maxability.co.in, I am learning
javascript. My target is to put as many code examples as I could on my
blog with which developers could be benefited.

I am currently working on focus. I have tried to set focus on an element
when a button is clicked. The focus is perfectly working when I use NVDA
on internet explorer and Firefox. while using JAWS the focus cannot be
set to elements such as paragraph, span and headings. Even for elements
such as buttons, text boxes and anchor tags the focus is working only once.

Below is the code I have used.
HTML code:

<p id="ct">Changing content using javascript function</p>
<input type="button" onClick="testFocus()" value="return to top">

Javascrpt Code:

<script>
function testFocus()
{
var target = document.getElementById('ct');
target.setAttribute("tabindex" , "0");
document.getElementById("ct").focus();
}
</script>

Thanks & Regards
Rakesh Paladugula
www.maxability.co.in