I grabbed this snippet from another question:
It is possible to achieve what you are looking for using just CSS:
ul li a {background-color: white;} ul li a:hover {background-color: black;} ul li a:focus {background-color: black;}
Demo