views:

35

answers:

2

I have the below code but it is not working. Is this correct?

var diffLvl = document.getELementById('lvlDiff');
var interLvl = document.getElementById('lvlInter');
var simpLvl = document.getElementById('lvlSimple');

if (simpLvl.checked) {
    //do stuff
  } else if (interLvl.checked){
    //do stuff
  } else {
    //do stuff
  }
+5  A: 

Yes, it's correct except for a spelling error.

Javascript is case sensetive. Change getELementById to getElementById.

Guffa
+3  A: 

You have [...]getEL[...] on the first line. The L should be lowercase.

Júlio Santos
ah... thanks, I didn't notice that, thats probably the problem. Thanks!
chromedude
I've spent HOURS on problems such as this. Especially when sleepy :)
Júlio Santos
Yeah, thankfully I only spent about 10 mins. Thats whats good about SO :)
chromedude
How did people even code before the Internet? :D
Júlio Santos