jquery to copy two input fields into one with a space between

Solutions on MaxInterview for jquery to copy two input fields into one with a space between by the best coders in the world

showing results for - "jquery to copy two input fields into one with a space between"
Michele
13 Aug 2017
1jQuery(function($) {
2  var $firstname = $('input[name="firstname"]');
3  var $lastname = $('input[name="lastname"]');
4  var $fullname = $('input[name="fullname"]');
5
6  $firstname.add($lastname).keyup(function() {
7    $fullname.val($firstname.val() + ' ' + $lastname.val());
8  });
9});