i have a <div id="mainDIV"> which contains a <table> within which <thead> and <tbody> tags are present.
Actually i am trying these selector
$("#mainDIV > tbody").on("click", function(){
alert("test");
}
so that whenever we click inside the <tbody>, that alert should be displayed. But this is not working. Can anyone please suggest me solution for this.
I tried the below one but its not working…
$("#mainDIV tbody").on("click", function(){
alert("test");
}
This is my part of the code thats not working..
$("#ui-datepicker-div tbody").on("click", function(){
alert("test");
});
You should use white space instead of
>:Live DEMO
Descendant Selector (
"ancestor descendant") docs:Child Selector (
"parent > child") docs: