For my project, I am looking to pass three js values to the label of a div. The desired output is:
stWay: stProposer: stTime:
hello John 2017-09-07
I have successfully programmed a button to make div1 appear, but I am facing difficulties in retrieving and displaying the values from JavaScript. The values 'hello', 'John', '2017-09-07' are not appearing as expected.
To maintain the same format, I decided to use CSS for labeling instead of input elements.
Below is my current JavaScript code:
<script>
$(document).ready(function()
{
......//click button to make div1 display block
var reqStWay = "hello";
var reqPeople = "John";
var reqTime = "2017-09-07";
$("#div1").css('display','block');
$('#lblId').val(reqStWay);
$('#lblId').val()=$('#lblId').val().appendto(" ");
$('#lblId').val()=$('#lblId').val().appendto(reqPeople);
$('#lblId').val()=$('#lblId').val().appendto(" ");
$('#lblId').val()=$('#lblId').val().appendto(reqTime);
}
</script>
And here is my HTML code:
<style>
.DIV1 label{.........}
</style>
<div id="div1" class="DIV1">
<label>stWay: stProposer: stTime:</label><br />
<label id="lblId"></label><br />
</div>
I also tried using the following line of code:
$('#lblId').html(reqStWay" "reqPeople" "reqTime);
Unfortunately, this attempt failed too. Can anyone provide assistance?