From 7c7daafbe3b8d2b42a9e17a9917fdb155f5146ae Mon Sep 17 00:00:00 2001 From: Cappy Popp <356651+cappypopp@users.noreply.github.com> Date: Thu, 7 Jan 2021 10:37:16 -0500 Subject: [PATCH] bug: form not always avail looking for 1st row --- LinkedIn - Demo Form Autofill.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LinkedIn - Demo Form Autofill.html b/LinkedIn - Demo Form Autofill.html index 55f4aca..979ea0b 100644 --- a/LinkedIn - Demo Form Autofill.html +++ b/LinkedIn - Demo Form Autofill.html @@ -3,7 +3,7 @@ var fillScript = document.createElement('script'), // the LI autofill script (client-side) iframeHolderDiv = document.createElement('div'), // so we can style location of button autoFillLocation = document.querySelector("form[id^='mktoForm_']"), // will only find first Marketo form on a page - firstRow = document.querySelector('form .mktoFormRow'), + firstRow, mktoForm, hiddenLinkedInInputs = document.createDocumentFragment(), // since we're creating multiple nodes, just do the add once hiddenInputCreator = function (tagName, onChangeHandler) { @@ -324,6 +324,7 @@ // need the id of the form so we can hook up autofill // doing this way will work on any Marketo form fillScript.setAttribute('data-form', 'mktoForm_' + form.getId()); + firstRow = document.querySelector('form .mktoFormRow'); // so we can use it above mktoForm = form; // so we can use it above form.onSubmit(function (form) { // tell GA about it, but only if we know they autofilled