when I pressed the button, the data from the input is not changing inside the . please help. I am using Jquery for the function thank you so much in advance.
I'm new in HTML and Jquery. I include the snippet here in my post. Thank for the answers and comments in advance
$('buttonnext').click(function(){
// var date_id = $(this).attr("id");
var lastname = $('#lastname').val();
var firstname = $('#firstname').val();
var email = $('#email').val();
$('#datalastname').val(lastname);
$('#datafirstname').val(firstname);
$('#dataemail').val(email);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script><br><br>
Lastname <input type="text" name="" style="width: 250px;" id="lastname"><br><br>
Firstname <input type="text" name="" style="width: 250px;" id="firstname"><br><br>
Email <input type="text" name="" style="width: 250px;" id="email"><br><br><button class="btn btn-success" style="width: 250px;" class="buttonnext">Next</button><br><br><table class="table table-bordered" style="border-style: solid;"><tbody><tr><td >Lastname</td><td id="datalastname">Tabios</td></tr><tr><td>Firstname</td><td id="datafirstname">Jimmy</td></tr><tr><td>Email</td><td id="dataemail">Johndoe@gmail.com</td></tr></tbody></table>