PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

How to pass values to different inputs using jquery [solved]

  1. I've been scratching my head all day on how to copy a First & Last name field and dynamically populate the "Title" field as "FirstName LastName". I've found several tutorials on the forum that didn't get me where I wanted to go.

    I have a multi-page form. My first attempt was to try to pass the First and Last name to the Title on a separate page. That didn't work and I've reverted back to moving the title to the same page as the FirstName LastName fields and hid it into admin view only.

    Ultimately, a couple of lines of Jquery got me where I needed.

    Before you see a code, here's the reference for my site:
    First Name: #input_1_28_3
    Last Name: #input_1_28_6
    Post Title: #input_1_7

    $('#input_1_28_6, #input_1_28_3').keyup(function() {
    	$('#input_1_7').val($('#input_1_28_3').val() + ' ' + $('#input_1_28_6').val());
    });

    Because we're all WP users here, let me remind you that this was placed in my javascript footer file and I had to turn all "$" into "$j" as well as a no-conflict.

    Posted 12 years ago on Tuesday July 31, 2012 | Permalink