Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Good Example: Focus moved to AJAX content with tabindex="-1" after a delay

<p><button id="liveButton">Create announcement</button>
<span id="liveRegion" aria-live="assertive"></span></p>
<p><button id="liveButton">Create announcement</button></p>
<script>
$('#liveButton').click(function(){
  var live = $('#liveRegion');
  live.css({
    'display':'inline-block',
    'background-color':'#fff5bc',
    'padding':'0px 4px'
  }).text('Hooray for accessibility!');
  setTimeout(function(){ 
    live.text('');
    live.removeAttr('style');
  }, 3000);
});
</script>
Comment

Good Example: Focus moved to AJAX content with tabindex="-1" after a delay

<div id="decContainer"></div>
<script>   
$("#decButton").click(function(){
  $.ajax({
    url: "assets/html/module-dynamic/ajax/declaration.html", 
    type:'GET',
    cache: false,
    success: function(result){
      $("#decContainer").show().html(result);
      var decHeading = $("#decContainer h2:first");
      /* set tabindex="-1" so the heading can receive keyboard focus */
      decHeading.attr('tabindex','-1');
      setTimeout(function(){ 
        /* move focus to the heading after a delay of 1 second */
        $("#decContainer h2:first").focus(); 
      }, 1000);
    }
  });
}); 
</script>
Comment

PREVIOUS NEXT
Code Example
Javascript :: Create Built-in AbortController Object 
Javascript :: react_devtools_backend.js:4026 Warning: Cannot update a component (`BrowserRouter`) while rendering a different component (`Login`). 
Javascript :: array operations = map, filter, find, reduce, some, every, indexOf 
Javascript :: Object.entries() To Use For Of On JSON 
Javascript :: how to get creator of inetarceton discordjs 
Javascript :: Create A Class That Returns A Promise In Constructor 
Javascript :: The JavaScript call() Method 
Javascript :: what does the symbol function do in javascript 
Javascript :: general hardhat config js file code 
Javascript :: Update A Value In ExpressJS/MongoDB 
Javascript :: jQuery mobile anchor link on the same page 
Javascript :: load limited data and search data from all in angularjs 
Javascript :: use function in mongodb query example 
Javascript :: How to Loop Through an Array with a While Loop in JavaScript 
Javascript :: javascript variable scope in if statement 
Javascript :: discord.js sync channel permissions 
Javascript :: How do I target and change the style of a different element when I click a button in react 
Javascript :: javascript count number of lines of a text 
Javascript :: remove parent element jquery 
Javascript :: insert element in array javascript 
Javascript :: convert 12 hour to 24 hour javascript 
Javascript :: how to scroll automatically to the bottom of the page using javascript 
Javascript :: regex in javascript 
Javascript :: static in class javascript 
Javascript :: javascript post request 
Javascript :: mdn objects javascript 
Javascript :: jenkins javascript heap out of memory 
Javascript :: JavaScript Number Objects 
Javascript :: javascript AutoCorrection in Date Object 
Javascript :: !Object.construct polyfill 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =