<ul>
<li class="abc">Item 1</li>
<li class="abc">Item 2</li>
<li class="abc">Item 3</li>
</ul>
(function (document) {
var selectedItem = null;
document.querySelector('ul')
.addEventListener('click', function(e) {
if (selectedItem) {
selectedItem.className = selectedItem.className.replace(' selected', '');
}
if (e.target.className.indexOf('selected') == -1) {
e.target.className += ' selected';
}
selectedItem = e.target;
});
})(document);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>StarHunter</title>
<link rel="stylesheet" type="text/css" href="style/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
</head>
<body>
<header>
<nav></nav>
</header>
<ul>
<li class="li">1111</li>
<li class="li">2222</li>
<li class="li">3333</li>
</ul>
<script>
$(document).ready(function(){
$(".li").click(function(){
var text = $(this).html();
alert(text);
});
});
</script>
</body>
</html>