samedi 25 avril 2015

dynamically created input button is being skipped by tabbing ... how to set tabindex


I have dynamically created a table with elements followed by a search and reset button. In general tabbing works through input fields and select fields in the table. Tabbing skips over checkbox which is not bothering me. However, after the table comes two buttons, search and reset. Adding these buttons dynamically will get skipped over when tabbing.

$('#' + div_id).append('<input type="button" class = "button" value="Search" onclick="'+this.table_name+'.submitSearch()">');
$('#' + div_id).append('<input type="button" class = "button" value="Reset" onclick="'+ this.table_name +'.resetSearch()">');

I have tried adding the following code:

$(":input:not(:hidden)").each(function (i) 
    {
        console.log(this.id);
        $(this).attr('tabindex', i + 1); 
    }); 

Which is not helping. Php generated html code works as expected. Thanks for your help!!!


Aucun commentaire:

Enregistrer un commentaire