Loser18
Loser18

Reputation: 3

Number does not appear in span

I have created a function that generates a number. I want to put the number into a span element. However, this will not work. The function works and if I put the number into a value box it works. These are the two parts of code pertaining to the question.

Code:

document.getElementById('average').innerhtml= averagescore
Average Score:<span id='average'> 0 </span>

Upvotes: 0

Views: 68

Answers (3)

Sushil Kandola
Sushil Kandola

Reputation: 880

Keep in mind the case-sensitivity of any programming language. JavaScript and jQuery are Case Sensitive Languages. Two Variables like

  var abc;
  var ABC;

both are different. So same happens in your case innerHTML vs innerhtml, which are totally different.

Upvotes: 0

Madhawas
Madhawas

Reputation: 391

Try this

document.getElementById('average').innerHTML = "your value"

Upvotes: 0

Mykle Nero
Mykle Nero

Reputation: 85

The error might be with .innerhtml. You should write .innerHTML instead. Note the 'HTML' is all caps.

Upvotes: 3

Related Questions