首页javascriptanchorjQuery HTML Element - 如何单击以突出显示锚链接

jQuery HTML Element - 如何单击以突出显示锚链接

我们想知道如何单击以突出显示锚链接。

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.6.js'></script>
<style type='text/css'>
a {
  cursor: pointer;
}

.directionsselect {
  background-color: black;
  color: white;
}
</style>
<script type='text/javascript'>
$(window).load(function(){
    $(document).ready(function() {
        $('#outdirections a').click(function() {
            $('#outdirections a').removeClass('directionsselect');
            $(this).addClass('directionsselect');
        })
    });
});
</script>
</head>
<body>
  <div id="outdirections">
    <a>Item</a> <a>Item</a> <a>Item</a> <a>Item</a> <a>Item</a>
  </div>
</body>
</html>