When i add the if (hubsAndCenter[i])
line this function stops working (It becomes busy and the whole page stops responding) Can anybody see what i'm doing wrong?
function UpdateHubsAndCenter() {
var hubsAndCenter = $("#HubsAndSiteSection :button");
for (var i = 0; hubsAndCenter.length; i++) {
if (hubsAndCenter[i])
Update(hubsAndCenter[i].value, hubsAndCenter[i].value);
}
}
The problem is you don't have any real halting condition, the loop will run as long as the jQuery collection isn't empty.
Instead of
for (var i = 0; hubsAndCenter.length; i++) {
you probably should have this :
for (var i = 0; i < hubsAndCenter.length; i++) {
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.