From 8359318b475f42367e2314fbad46f9a7a8d50b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Thorz=C3=A9n?= Date: Mon, 26 Nov 2018 13:08:26 +0100 Subject: [PATCH] First check that we find an input before accessing found elements --- src/jquery.typeahead.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/jquery.typeahead.js b/src/jquery.typeahead.js index 0c4e2cd..e250726 100644 --- a/src/jquery.typeahead.js +++ b/src/jquery.typeahead.js @@ -3780,9 +3780,6 @@ node = $(options.input); } - if (typeof node[0].value === "undefined") { - node[0].value = node.text(); - } if (!node.length) { // {debug} _debug.log({ @@ -3797,6 +3794,9 @@ return; } + if (typeof node[0].value === "undefined") { + node[0].value = node.text(); + } // #270 Forcing node.selector, the property was deleted from jQuery3 // In case of multiple init, each of the instances needs it's own selector!