javascript - using 2 css class for click function doesn't work in JQuery -


i have following code snippet. understanding that, following code fires, when <li class="topics">topics</li> clicked on. however, observing that, click function doesn't fire.

   $(".li .topics").click(function () {     } 

however, if removing .li ,

   $(".topics").click(function () {     } 

then click function works fine, doing wrong here? please advise

li not class, element. can remove period .li , have this:

$("li.topics").click(function () {} 

also, when have space between classes, looks second class nested inside of first, however, when remove space, looks element has class.


Comments