I am trying to get a form field to autofill with the same value as another field using Ninja Forms and Wordpress. I have looked at some solutions using JQuery but none of them seem to work. Please help me figure out what I am doing wrong.
Here is a link to the form: https://optionsqa.wpengine.com/test-page/
I want to get the content in "COPY THIS LINK" to automatically populate the field below.
This is the script I am trying:
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('.copy-link').on('change', function() {
jQuery('.favorite-link-field').val($(this).val());
});
});
</script>
jQuery solution (updated to include ninja form ready state, as per comments):
I prefer using the
id
overclass
since classes can be used multiple times. That being said:This will update when
#nf-field-10
orFavorites Link
is changed.