autofill field
-
Hello, I’m using a jquery function to capture a value from the URL and then insert it into the form’s phone field. When I use it, I can actually populate the field, but for some reason, as soon as I click on the field, the value disappears. And more, when I submit the reservation, it records the value in another key, the same key as the URL (site.com/?key=274981279487). Can you help me? The function I use is this:
function autopopulate_field() { ?> <script> jQuery(document).ready(function($) { var param = new URLSearchParams(window.location.search); var value = param.get("param"); if (value) { value = decodeURIComponent(value); value = atob(value); var intervalId = setInterval(function() { if ($("input[name='phone']").length) { $("input[name='phone']").val(value); clearInterval(intervalId); } }, 500); } }); <script> <?php } add_action('wp_footer', 'autopopulate_field');But I am willing to any other means as long as I can enter the URL data
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘autofill field’ is closed to new replies.