0

I'm creating an accessible website for disabled students using access technologies to answer a survey. As such it needs a lot of visual feedback.

I use javascript to change css styles of an imagelink (that's used to select a radio button.) When the image link has focus it changes styles - however once the image is clicked (therefore clicking the radio button) I'd like it to change to a 3rd style and stay like that until another button is clicked. Currently the mouseout and onblur events stay active and revert back to the unfocused style.

All code is on this fiddle: http://jsfiddle.net/KK4xe/2/

I've tried: if statements for when the radio is selected and rewriting div contents onclick so that the

Many thanks, Mike

(note. the radio button will be hidden with CSS once sorted so that it doesn't interfere with screen readers etc.)

1 Answer 1

1

Try this ;

function changeClass1(){
--> if(!document.getElementById("YES").checked){
        document.getElementById("1").setAttribute("class", "optionfocus");
    }
}

function changeClassBack1(){
--> if(!document.getElementById("YES").checked){
        document.getElementById("1").setAttribute("class", "option");
    }
}

see example

Note: * i also added the hidden attribute for the check box (to ensure it work when hidden)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.