I want to have a contextmenu listening on a right-click on a specific cell.
In html file, I linked the Script by writing
<script src="ContextMenuController.js"></script> // link the js file
<link rel="stylesheet" type="text/css" href="ContextMenuStyle.css"> // link the css file
In my js-file i want to create this contextmenu by writing
$(this).closest('td').onmousedown = function(event) { // get the cell clicked on
if (event.which == 3) { // just build the menu on a right click
var contextElements = ["btnAddRowAbove", "btnAddRowBelow", "btnAddColumnLeft",
"btnAddColumnRight", "btnMoveRowUp", "btnMoveRowDown", "btnMoveColumnLeft",
"btnMoveColumnRight", "btnDeleteRow", "btnDeleteColumn", "btnUndo", "btnRedo"]; // store all the buttons of the menu
var menuText = "<ul class=\"contextmenu\">"; // the wrapper
for (var i = 0; i < contextElements.length; i++) {
menuText += "<li id= contextElements[i]> contextElements[i] <\/li>"; // append all the buttons to the wrapper
}
return menuText + "<\/ul>"; // finish the wrapper
}};
When i try to debug it with alert()
the code does not even reach this function.
Could someone help me out?