Change Font Color on Hover

Hello everyone,

I’m trying to change the font color upon hovering of my CSS ID’s #realmaturesingles and #seniorpeoplemeet. How do I do this using JavaScript? :sick:This is what I’ve tried.


<script type="text/javascript">
$('#seniorpeoplemeet').FontEffect({
		gradient:true,
		mirror:true,
		mirrorColor:"#CCC"
 })

$('#realmaturesingles').FontEffect({
		gradient:true,
		mirror:true,
		mirrorColor:"#CCC"
 })

function seniorPeopleMeetInitial()
{
	$('#seniorpeoplemeet').FontEffect({
		gradient:true,
		mirror:true,
		mirrorColor:"#CCC"
 		})
}

function realMatureSinglesInitial()
{
	$('#realmaturesingles').FontEffect({
		gradient:true,
		mirror:true,
		mirrorColor:"#CCC"
 	})
}

function seniorPeopleMeetChange()
{
	$(this).find("#seniorpeoplemeet").css('color', '#666');
}

function realMatureSinglesChange()
{
	$(this).find("#realmaturesingles").css("color", '#666');
}

$("#realmaturesingles").hover(realMatureSinglesChange(), realMatureSinglesInitial());
$("#seniorpeoplemeet").hover(seniorPeopleMeetChange(), seniorPeopleMeetInitial());
</script>

(:

What does your HTML look like?

You could probably do this with CSS instead by using the :hover selector.

:hover (CSS selector)


<div style="padding-bottom:5%;"><a href="http://www.atlantareviewgroup.com/dating/seniorpeoplemeetreview1.php" id="seniorpeoplemeet" style="width:50em; padding-right:3em;">Senior People Meet</a></div>

I should do it not only in CSS, but in JavaScript, too, for multi-browser compatibility, right?

Nope. All you need is CSS.

Granted, IE doesn’t support the :hover selector for all HTML elements beyond the <a> tag, but you can add in a .htc behavior file to address the deficiency.

I would like to learn this in JavaScript just so I get some practice with JavaScript. Will you still help me?