0

I found this script from google. But it isn't working with tabindex. can you help me how to fix this.

here is jsfiddle link

js snippt:-

$('select').each(function () {

    // Cache the number of options
    var $this = $(this),
        numberOfOptions = $(this).children('option').length;

    // Hides the select element
    $this.addClass('s-hidden');

    // Wrap the select element in a div
    $this.wrap('<div class="select"></div>');

    // Insert a styled div to sit over the top of the hidden select element
    $this.after('<div class="styledSelect"></div>');

    // Cache the styled div
    var $styledSelect = $this.next('div.styledSelect');

    // Show the first select option in the styled div
    $styledSelect.text($this.children('option').eq(0).text());

    // Insert an unordered list after the styled div and also cache the list
    var $list = $('<ul />', {
        'class': 'options'
    }).insertAfter($styledSelect);
Marmik Desai
  • 104
  • 11

1 Answers1

0

Need to set tabindex dynamically with jQuery.

//Adds tabindex dynamically 
$this.attr("tabindex", "0");

http://jsfiddle.net/elitownsend/BB3JK/4733/

EliTownsend
  • 181
  • 11