We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Aug 5, 2020 4:13 AM
Hi all,
Looking to set up the following process (need help with step 3):
Thanks for all thoughts in advance.
Solved! Go to Solution.
Aug 5, 2020 4:39 PM - edited Aug 5, 2020 4:39 PM
Following up on my comment:
Checkout @amwilie 's answer to this post. This is the technique you'd want to use to get the info.
Write a function similar to the code below to get the data and add it to the window object:
$(document).ready(function() { // Declare your table data variable var tableData = []; $('#target tr').each(function(index) { // Add empty array to the tableData variable tableData.push([]); // Loop through trs and push values to the array at index $(this).find('td').each(function(j, el) { tableData[index].push(el.textContent); }); }); // Add the tableDato the window object for easy access window.tableData = tableData; });
You'll get a data structure like so:
Then write a function that populates the hidden fields in the popup. Somthing like this maybe:
$('#hidden-field-id').val(window.tableData[1][2]);
Aug 5, 2020 1:00 PM
Hey @Jf2
So this could be rather simple:
On page load capture the table data and store it on the window.
On "exit intent", popup a form with hiden field.
Populate the forms hidden field with the data from the window variable.
Aug 5, 2020 4:39 PM - edited Aug 5, 2020 4:39 PM
Following up on my comment:
Checkout @amwilie 's answer to this post. This is the technique you'd want to use to get the info.
Write a function similar to the code below to get the data and add it to the window object:
$(document).ready(function() { // Declare your table data variable var tableData = []; $('#target tr').each(function(index) { // Add empty array to the tableData variable tableData.push([]); // Loop through trs and push values to the array at index $(this).find('td').each(function(j, el) { tableData[index].push(el.textContent); }); }); // Add the tableDato the window object for easy access window.tableData = tableData; });
You'll get a data structure like so:
Then write a function that populates the hidden fields in the popup. Somthing like this maybe:
$('#hidden-field-id').val(window.tableData[1][2]);