1

I have a web application with no images in it. It is for visually impaired people. It is navigated using TAB button. How can I get the title/text of the selected web page like button,menu,etc. By selected I mean using TAB button, not mouse click. Using Javascript or any other language.

Prajwal
  • 17
  • 4

1 Answers1

0

Use .focusin() method of jQuery library. Try to navigate on the form inputs from the snippet below using TAB button.

$(document).focusin(function(e) {
  console.log(e.target.name);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form action="#">
  <input type="text" name="input1"/>
  <input type="text" name="input2"/>
  <input type="text" name="input3"/>
</form>

I used name property of the event target in my example, but you could get any property value. For example

$(document).focusin(function(e) {
  console.log($(e.target).attr("type"));
});

It is possible to get id and another info by same way.

Alexander
  • 4,420
  • 7
  • 27
  • 42