I am using file-input with Jasny bootstrap. Everything is fine except in Keyboard Tab focus Field is not highlighting. Please provide me a solution. Thanks
There are two things you have to do: make the "buttons" (they are spans) focusable and bind keypress
event to click on hidden input.
I'm really bad with javascript, so this could be done better, but it works for me at the moment:
$('.fileinput .btn').each(function(){
if ($(this).attr('tabindex') === undefined) { // if it hasn't tabindex
$(this).attr('tabindex', 0);
}
$(this).on('keypress', function(e){
if ( e.which == 13 ) { // only works with enter key
$(this).children('input').click();
}
});
});
please fix my english and my code, I use them to work :D