1. 程式人生 > >jQuery的each內部的break,continue

jQuery的each內部的break,continue

tel 可用 style 叠代器 this css type sel selected

// break, continue在each等叠代器裏都不可用
// return false = break
// return true = continue
function isClickedSelectedBodyType(self) {
    var selected = null;
    $(‘.body_type_select_button‘).each(function () {
      var title = this.getElementsByClassName(‘img-title‘)[0];
      selected = this;
      if ($(title).css(‘color‘) === selectedBodyTypeFontColor) {
        
if (selected === self) { return false; // break } } }); return self === selected; }

jQuery的each內部的break,continue