I must be doing something wrong but I don't see what. I have a list of divs and I want that when they click on an element of the list I get its id. I currently have this but I can't get it to work.
(function($) {
function selectParams() {
$(this).click(function(){
var id = $(this).attr("id");
console.log(id);
});
}
})(jQuery);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="first-column" id="first-column">
<li id="WE"><div><span>WERK</span></div></li>
<li id="OU"><div><span>OUTER</span></div></li>
<li id="IN"><div><span>INTRA</span></div></li>
</div>
What happens is that the selector of the click event is wrong. You have it in this but what you should put is the element in which the event is specified, it should be in the element
li
: