Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I want to change the color of radio buttons when I get a reply but it does not work.

any idea why the color does not work?

What I have tried:

function quiz() {
    var getIdeo = $('input[name="ideogram"]:checked').val();
    var getPin = $('input[name="pinnin"]:checked').val();
    $.post("match_check.php", { getIdeo: getIdeo, getPin: getPin },
    function(data) {
	 if ( data == "CORRECT" ) {
		 $("input[name=ideogram]:checked").css('color', 'green');
		 $("input[name=pinnin]:checked").css('color', 'green');
	 }
	 $('#results').html(data);
	 //$('#myForm')[0].reset();
    });
}
Posted
Updated 3-May-22 5:56am

1 solution

An <input type="checkbox"> ignores the color CSS property. If you want to change the check colour, you would need to use the new accent-color property[^] instead.
JavaScript
$("input[name=ideogram]:checked").css('accent-color', 'green');
$("input[name=pinnin]:checked").css('accent-color', 'green');
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900