Selaa lähdekoodia

Merge pull request #736 from tamias/label_no_element

Avoid error when label has no matching element
Igor Vaynberg 12 vuotta sitten
vanhempi
commit
17f9d78e26
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  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();}
             }
         });
     });