So I’m trying to tab between input fields and select fields in a sliding form. However, with the code that I have it skips over the last input field on the current section of the form or the last select field on the current section of the form, regardless of whether there is a select or input field respectively afterwards. I need the tab to make sure that there are no select fields after the last input field and vice versa. This is the code I have so far:
$(this).find('input:last,select:last').bind('keydown',function(e){
But I need to to function more like this:
$(this).find('input:last && select:last').bind('keydown',function(e){
But the above code is not possible. Any ideas?
Instead of using the
:lastselector, you need to use the.last()method:Reference for learning: .last()