Frequently asked questions Custom Code

How do I fill the form fields with the UTM parameters data?

How do I fill the form fields with the UTM parameters data?

Examples below require knowledge of Javascript and CSS. Tilda Customer Support does not assist in code-related questions.

Add a T123 block from the “Other” category and insert the following code:

<script type="text/javascript">
var url = new URL(window.location.href);
var params = new URLSearchParams(url.search.slice(1));
for(var key of params.keys()) {
var content = params.get(key);
if (content != undefined && content != "") {
$("[name='" + key + "']").val(content);
}
}

/* Если в ваших полях есть текстовые подсказки, то обязательно добавьте код ниже */
$(document).ready(function() {
setTimeout(function(){
$('input,textarea').focus();
}, 500);
});
</script>
Was this answer helpful?
Yes
0
No
0
Views: 330