How would I simulate the effect that happens to a checkbox when you hover over it using jQuery? When you do this in Chrome and Firefox, the checkbox input is highlighted blue.
To give a bit more context, I have a grid like so:
<table>
<tbody>
<tr>
<td><input type="checkbox" /></td>
<td>this is a checkbox</td>
</tr>
</tbody>
</table
I want to make it that the checkbox is highlighted the default blue colour when a user hovers over the <tr>
I realise I could put a label around this is a checkbox and reference the checkbox with the for attribute, however I would rather trigger this effect on hover over the <tr>.
I’m a bit suspicious about using CSS to style the checkbox input itself as it seems a bit hacky.
/edit after your edit: Some browsers (like Opera) seem to allow you to do things like
padding-right:100pxso that hovering the mouse near the checkbox would highlight the checkbox as well. You can try waste some time with that, but I’d highly recommend you do it with libraries.That blueish hover sort of thing is from the operating system. Only imaginable way would’ve been to focus it but obviously it doesn’t work.
You can do what we’ve all been doing for the past decade, turn checkboxes into hidden inputs and use images. Plenty of libraries out there.
Here’s one.