0

I have this :

<div class="glass">
<input />
<input />
<select>
<option>aaaa</option>
</select>
</div>
<input />

What i want is to remove div with glass class from tabing that is cloned, so when i do tab it skip that div. Any suggestion ?

Im doing clone element :

 this.background = jQuery(this.content.nativeElement).clone()
        .addClass('glass').removeAttr('tabindex');
None
  • 8,817
  • 26
  • 96
  • 171
  • Possible duplicate of [How to ignore HTML element from tabindex?](https://stackoverflow.com/questions/5192859/how-to-ignore-html-element-from-tabindex) – Andreas Aug 02 '17 at 09:42
  • im using clone...how is that same? – None Aug 02 '17 at 09:44
  • 1
    can you provide a working example with https://jsfiddle.net/ or the internal code editor ? in general a div is not focused on tab. if you want the inputs to be ignored you should add `.find(':input')` before setting the tabindex to negative – fehrlich Aug 02 '17 at 09:48

1 Answers1

1

based on the w3c specs, the tabindex should be set to a negative value. Your code should look like this:

 this.background = jQuery(this.content.nativeElement).clone()
    .addClass('glass').prop('tabindex', -1);
fehrlich
  • 2,497
  • 2
  • 26
  • 44