samedi 23 décembre 2017

How to use elseif statement to show hidden text

New to Javascript, need some help with hidden panels.

I want the user to answer some questions in a radio button form which will have different values assigned to the checked answers. There will be 3 different options of results in hidden panels, one result will be displayed at the end depending on the score.

Link to full code and html here

function results() {
            var lRisk = document.getElementById('lowRisk')
            var mRisk = document.getElementById('mediumRisk')
            var hRisk = document.getElementById('highRisk')

        if ((score >= 0) && (score =< 15)) {
            lRisk.style.display = 'inline';
        } else if ((score >= 16) && (score <= 25)) {
    mRisk.style.display = 'inline';
         } else {
        lRisk.style.display = 'inline';
        }

Would be very grateful for any help/advice!

Aucun commentaire:

Enregistrer un commentaire