2
I am using this code, to put the embroidery in red when a field of the tab is not filled correctly, and it then gives the Focus on the nearest tab, and so on.
$.each($('input[data-required="true"]'), function () {
if (!this.value || this.value == '') {
e.preventDefault();
$(this).css('border', 'red 1px solid');
var id = $($(this).parents('.tab-pane')[0]).attr('id');
$('[href="#' + id + '"]').trigger('click');
$(this).focus();
return false;
}
});
I’d like you to focus
in the first field, for the user to already type in the field. I tried adding this line:
$(this).focus();
But it didn’t work.