I'm trying to copy and pass values from input boxes in my form to different labels on the same form. I'm doing this because i need to have a summary at the end of the page of all the inputted text before submitting it. Before anything else, i already can copy most of my input boxes into a label but i'm having a hard time passing the value/text of google autocomplete and datetimepicker input boxes into labels. I tried searching but none of them worked. Here's what i have:
HTML
<h3><span class="number"><i class="icon-note txt-black"></i></span><span class="head-font capitalize-font profile-tab">profile</span></h3>
<fieldset>
<div class="row">
<div class="col-sm-12 col-xs-12">
<div class="form-wrap">
<div class="col-md-12 col-sm-12 col-xs-12 form-group">
<label class="control-label mb-10" for="">Address:</label>
<div id="pac-container">
<input id="address" type="text" name="address" class="form-
control" placeholder="Enter a location">
</div>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 form-group">
<label class="control-label mb-10" for="">date of birth:</label>
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" id="bday" name="bday" />
<span class="input-group-addon">
<span class="fa fa-calendar"></span>
</span>
</div>
</div>
</div>
</div>
</div>
</fieldset>
<h3><span class="number"><i class="icon-user txt-black"></i></span><span class="head-font capitalize-font">Caretaker's Information</span></h3>
<fieldset>
<div class="row">
<div class="col-sm-12 col-xs-12">
<div class="form-wrap">
<h2>SUMMARY</h2>
<hr>
<div class="col-md-12 col-xs-12 form-group">
<div class="form-group">
<label class="control-label col-md-3">Address:</label>
<div class="col-md-9">
<label name="address2"></label>
</div>
</div>
</div>
<div class="col-md-12 col-xs-12 form-group">
<div class="form-group">
<label class="control-label col-md-3">Birthday:</label>
<div class="col-md-9">
<label name="bday2"></label>
</div>
</div>
</div>
</div>
</div>
</div>
</fieldset>
Most of my input boxes are formatted this way.
Here's my js
<script type="text/javascript">
$(document).ready(function(){
$("#address").on('change', function (){
var a = $(this).val();
$('[name="address2"]').text(a);
});
$("#bday").on('change', function (){
var a = $(this).val();
$('[name="bday2"]').text(a);
});
$('#datetimepicker1').datetimepicker({
useCurrent: false,
icons: {
time: "fa fa-clock-o",
date: "fa fa-calendar",
up: "fa fa-arrow-up",
down: "fa fa-arrow-down"
},
}).on('dp.show', function() {
if($(this).data("DateTimePicker").date() === null)
$(this).data("DateTimePicker").date(moment());
});
});
</script>
What am i lacking? I can't seem to pass the address and date into a label. If its not possible with a label, another input box will be okay. Note: they are all on the same page.