apologies by the way, i have never touched jquery before so i have no idea what i am doing.
i am trying to add a bit of jquery code in my html page, i cannot really paste the entire page, but essentially i have this block contained in section:
<script defer src="script.js"></script>
<script>
$('a').hover(function() {
$(this).css('color', 'green');
}, function() {
$(this).css('color', 'black');
}
);
window.onload=function(){
}
</script>
however, the links on my page does not reflect the hover effects changes i wrote here
what could i be doing wrong? and please let me know if the entire page has be posted in order for any sort of troubleshooting...
EDIT: okay I have made a test page, there isn't much on it, but the jquery commands still does not work here:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<script src="http://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<title>Test Page</title>
<script>
$('a').hover(function() {
$(this).css('color', 'green');
}, function() {
$(this).css('color', 'black');
}
);
</script>
</head>
<body>
<h1 id="headingOne">Header 1</h1>
<a href="google.com">Link 1</a>
<a href="google.com">Link 2</a>
<a href="google.com">Link 3</a>
</body>
</html>
PS: i understand that it is not necessary to be using javascript/jquery for any of this, but this is for a school assignment and it says to be using jquery for this task...