Question: I have a speed typing game. I also have a form with 3 radio buttons and i want to select the level of the game based on the selected radio button. How can i do that?

I've tried with `document.querySelector('input[name="genderS"]:checked').value;` this code here. But it doesn't worked

```
const levels = {
  easy: 5,
  medium: 3,
  hard: 1
};

let easyChecked = document.querySelector('#radio-easy').checked;
let mediumChecked = document.querySelector('#radio-medium').checked;
let hardChecked = document.querySelector('#radio-hard').checked;

var currentLevel = levels.medium;
let time = currentLevel;
let score = 0;
let isPlaying;

// To change level
function isChecked() {

}

```

I expect currentLevel variable to be changed based on the radio buttons.

Answer: 
Something like this:

```
// Get your progress bar element
let progressBar = document.getElementsByClassName('progressbar');
// update the style width
progressBar[0].style.width = Math.floor(finishSize*100/totalSize)+'%';

```

In your fiddle, **Math.floor(finishSize\*100/totalSize)+'%'** is evaluating to zero, so the bar isn't showing, that's whole other issue, but you can add this at the end of your showImage function to see that it will update your progress bar:

```
// Get your progress bar element
let progressBar = document.getElementsByClassName('progressbar');
// update the style width
progressBar[0].style.width = Math.floor(finishSize * 100 / totalSize) + '%';
progressBar[0].style.width = '33%';

```
```
let progressbar = document.querySelector('.progressbar');
progressBar.style.width = Math.floor(finishSize*100/totalSize)+'%';

```

First of all you neet select what you want change, in this case the class progressbar, after you can use `element.style.width = SIZE`
to select a element you can use `querySelector` if you are sure that will get only the first element or `getElementByClassName` for get a array off elements

[Here a explain about js selector element](https://stackoverflow.com/questions/14377590/queryselector-and-queryselectorall-vs-getelementsbyclassname-and-getelementbyid)

[querySelector document](https://www.w3schools.com/jsref/met_document_queryselector.asp)

[getElementByClassName document](https://www.w3schools.com/jsref/met_document_getelementsbyclassname.asp)