function addModel() {
var values = new Array();
var $input = $('input[type=\'text\']');
var error = 0;
$input.each(function() {
$(this).removeClass('double-error');
var that = this;
if (that.value!='') {
values[that.value] = 0;
$('input[type=\'text\']').each(function() {
if (this.value == that.value) {
values[that.value]++;
}
});
}
});
$input.each(function(key) {
if (values[this.value]>1) {
//error++;
var name = this.value;
var product_model = $(this).parent().parent().find('.product-model').text();
var m = product_model.toLowerCase().areplace(search,replace);
$(this).parent().find('input[type=\'text\']').val(name + '-' + m);
}
});
return error <= 0; //return error > 0 ? false : true;
}
那裏有很多的投入,以複檢......多達50000通常是約5000至20000輸入。當然,瀏覽器正在凍結...如何將此功能移動到網絡工作者,並稱之爲獲取數據和填寫表單類型=「文本」
謝謝你提前。
網絡工作人員將無法訪問DOM。爲什麼在一個頁面上會有5萬個文本字段? – Pointy
https://www.w3schools.com/html/html5_webworkers.asp – Aubin
*「哪裏有很多條目要重新檢查」*您的「條目」是什麼意思?當然不是文本字段?如果是這樣,我無法想象瀏覽器甚至可以在上面運行您的代碼...... –