Reputation: 429
$('resultsBlue').append('<p><b>Verschil: </b>' + (randomNumber1 - randomNumber) / 1000 + ' Seconden</p>');
#resultsBlue {
background-color: #6699ff;
border-radius: 7px;
}
.resultDiv {
height: 200px;
width: 300px;
display: inline-block;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='resultsBlue' class='Div'>
<h1>Blauw</h1>
</div>
That's a snippet of all of the code that has to do with this issue
As you can see in the snippet, I'm trying to append multiple data types but it just doesn't seem to work. How do I get it to do what I want? Thank you in advance
Upvotes: 0
Views: 32
Reputation: 2304
Try $('#resultsBlue')
since you're selecting an element which has an id
property.
Upvotes: 0
Reputation: 68933
You forgot to put #
in the selector.
$('#resultsBlue').append('<p><b>Verschil: </b>' + (randomNumber1 - randomNumber) / 1000 + ' Seconden</p>');
Upvotes: 3
Reputation: 163352
You need to prepend an #
for the id.
I think
$('resultsBlue').append('<p><b>Verschil: </b>' + (20 - 10) / 1000 + ' Seconden</p>');
should be
$('#resultsBlue').append('<p><b>Verschil: </b>' + (20 - 10) / 1000 + ' Seconden</p>');
Upvotes: 0