Skip to content

Instantly share code, notes, and snippets.

@crossan007
Last active August 18, 2017 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crossan007/9830e6a5a1af91191f6ca4faf8a4ac43 to your computer and use it in GitHub Desktop.
Save crossan007/9830e6a5a1af91191f6ca4faf8a4ac43 to your computer and use it in GitHub Desktop.
CSS Class Based TabIndex
function setTabIndex()
{
NWF$("[class^='ts-']").each(function(i,ele) {
var tabIndex = parseInt(ele.className.match(/ts-(-?\d?)/)[1]);
NWF$(ele).attr("tabindex",tabIndex);
console.log("set Tabindex " + tabIndex);
});
}
function clearTabIndex()
{
return NWF$('[tabindex]').each(function(i,ele) {
NWF$(ele).attr("tabindex","");
console.log("Clearing Tabindex");
}).promise();
}
NWF$(document).ready(function()
{
clearTabIndex().done(function(){
setTabIndex();
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment