소스 검색

Merge pull request #736 from tamias/label_no_element

Avoid error when label has no matching element
Igor Vaynberg 12 년 전
부모
커밋
17f9d78e26
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      select2.js

+ 1 - 1
select2.js

@@ -529,7 +529,7 @@ the specific language governing permissions and limitations under the Apache Lic
                 attr = attr.replace(/([\[\].])/g,'\\$1'); /* escapes [, ], and . so properly selects the id */
                 target = $("#"+attr);
                 target = target.data("select2");
-                if (target !== undefined) { target.focus(); e.preventDefault();}
+                if (target !== undefined && target !== null) { target.focus(); e.preventDefault();}
             }
         });
     });