diff --git a/select2.js b/select2.js index 958d0f5d..0fa211e2 100644 --- a/select2.js +++ b/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();} } }); });