Instead of using a setInterval function every 50 miliseconds, which will consume a lot of resources, you should bind your function on events like submit, or change. As it seems to be related to a form validation, you do not need to do anything unless the user modify a field.
SetInterval in Opera causes select blinking
-
29-06-2022 - |
سؤال
I need to group tooltips about errors showed by jQuery Validator. So I have written simple loop with setInterval to check if in the same row are more than one input with error class.
setInterval(function() {
$('.xrror').remove();
$('div.row-4:has([name].error)').each(function() {
var tmp = $('[name].error', this);
if(tmp.length > 1) {
$('label.error', this).hide();
tmp.last().parent().append(
$(document.createElement('label')).addClass('error').addClass('xrror').append(
$(document.createElement('span')).text('Fields with errors were marked with red color')
)
);
} else {
$('[name].error', this).parent().find('label.error').show();
}
});
}, 50);
And in Opera it's causing blinking on opened Select element.
المحلول
لا تنتمي إلى StackOverflow