While similar questions have been asked before, I am still unable to find a solution to my specific issue. I have a functional code in jsFiddle that creates a table and allows you to select a row to color it red. Everything works perfectly fine in jsFiddle, where I have selected no-wrap <body>
.
However, when I try the same code from my editor (Netbeans), it does not work. I have the JavaScript code in a separate file and the jQuery library added in the head.
var addition = 1;
var now = new Date(); //set time
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
var date = (day) + "." + (month) + "." + now.getFullYear();
function add() {
var operationTitle = $("#title").val();
var rowType = $("#type").val();
var urgencyLevel = $("#urgency").val();
$("#insertion").before("<tr id='new'><td>" + addition + "</td><td>" + operationTitle + "</td><td>" + rowType + "</td><td>" + urgencyLevel + "</td><td>" + date + "</td></tr>");
addition = addition + 1;
};
$("table").delegate("tr", "click", function () {
$(this).addClass("highlight");
});
$("#remove").click(function () {
$(".highlight").hide();
});