APIs & Integrations

Roxana_Carrion
Member

How can i call a hubspot form field to autofill with window.location.href

<div style="position: relative; top: -70px; margin-top: 30px;"><button type="button" class="button continue_browsing pull-right" style="margin-top:15px;" id="emailCartBTN">Email this Cart</button></div>
×
0 Upvotes
1 Reply 1
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

How can i call a hubspot form field to autofill with window.location.href

Hi @Roxana_Carrion,

I'm not entirely clear on that code's function, but here's an example of code that will populate an example field with the current URL:

$('input[name="example_field"]').val(window.location.href).change();