0

Is it possible to control the display of a radio button via mouse over events?

The goal would be so that it looks checked when the mouse is over and unchecked when the mouse leaves. But it only gets checked when it is clicked just like rating.

Tim Penner
  • 3,551
  • 21
  • 36
Shreya
  • 103
  • 1
  • 1
  • 13

3 Answers3

1

Unfortunately, the default browser radio button's background color cannot be styled via CSS, jQuery, or any other means. You might want to look into using custom images instead.

[UPDATE] Use CSS classes, and use jQuery only for toggling of classes.

$('body').on('click', '.fav-icon', function() {
    $(this).toggleClass('active');
});

See jsfiddle: http://jsfiddle.net/samliew/TWduB/5/

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
1

The simple answer is:

No you can't change the radio button's color.

instead you can customize it with your needs by using img sprites like this:

enter image description here

More information about it here : custom radios

Jai
  • 74,255
  • 12
  • 74
  • 103
0

Shreya, As far as I know the element (the round dot itself) will be hard to modify without any external plugins or libraries (something like This).

This is because the elements are a part of the browser.

It gets easier when you're trying to target a certain browser though.

A similar question has been asked on this platform, you can find it here.

Hope it helps! Good luck!

Community
  • 1
  • 1
El Dorado
  • 313
  • 1
  • 2
  • 14