Avoid error when label has no matching element
$('#no_such_element').data("select2") returns null rather than undefined (jQuery 1.9.0).
This commit is contained in:
parent
4e92c8b1b4
commit
7ec1e753dc
@ -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();}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user