I want to get two values first and last names in one hidden field with space between. I tried with this code
jQuery(document).ready(function($) {
$('input[name="firstname"]').keyup(function() {
$('input[name="fullname"]').val($(this).val());
});
});
jQuery(document).ready(function($) {
$('input[name="lastname"]').keyup(function() {
$('input[name="fullname"]').val($(this).val());
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="text" name="firstname" value="">
<input type="text" name="lasttname" value="">
<input type="hidden" name="fullname" value="">
It is not working how i want. It's showing only one value each time. Can anyone help me with this how can i get this work?
Thanks in advance.