I am working on a project where I am creating a 3 dot menu and want to add a click handler to.
I have the following HTML
<td z-var="ExceptionGroup @data-exception-group, CrashType @data-crash-type" data-exception-group="" data-crash-type="" class="context-menu" data-container-id="crash_group_menu"></td>
The above TD has the class context-menu which is as follows in CSS:
.context-menu:after
{
content: '\2807';
font-size: 20px;
cursor: pointer;
cursor: hand;
}
I've then tried the following jquery to select the 3 dot item and set a click event on it:
$('.context-menu[data-container-id="crash_group_menu"]').click(function(){
alert("hello");
});
The click event never gets fired but there is no javascript error in the develop console.
I've also tried the following:
$('.context-menu[data-container-id="crash_group_menu"]:after').click(function(){
alert("hello");
});
(Notice I've added :after
to the data-attribute selector) but no joy.
I've done this before when using div containers, is this not possible with class and data attribute selection or am I missing something somewhere?