What i am trying to do here is that i have a list, and each list item has the pseudo element :before
, initially the pseudo element will be set to display:none
, but when clicked on the list item i want to display the pseudo element placed before that item, how can i do this?
This what i have tried.
$('.lab-list li').on('click', function() {
$(this: before).css({
"display": "block"
});
});
.lab-list li {
list-style: none;
}
.lab-list li:hover {
cursor: pointer;
}
.lab-list li:before {
content: "\2708";
padding-left: 20px;
padding-right: 20px;
display: none;
}
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<ul class="lab-list">
<li>Stockholm</li>
<li>Delhi</li>
<li>Zurich</li>
<li>Newyork</li>
<li>South hampton</li>
<li>Manila</li>
<li>Singapore</li>
</ul>