Running Splunk examples and I get an error in this function.
var injectCode = function(code) { var sTag = document.createElement("script"); sTag.type = "text/javascript"; sTag.text = code; $(head).append(sTag); return sTag; } The exact error is in $(head).append(sTag); . This is placed inside a Jade file and it's running on Node. What am I doing wrong here?
EDIT - Sorry, head is defined as var head = $("head");right above the function.
And code comes from this function
var getCode = function(id) { var code = ""; $(id + " pre li").each(function(index, line) { var lineCode = ""; $("span" ,line).each(function(index, span) { if ($(span).hasClass("com")) { lineCode += " "; } else { lineCode += $(span).text(); } }); lineCode += "\\n"; code += lineCode; }); return code; }
head? Is it defined before?headexists? Maybe it should bedocument.head?head, like$("head").append(sTag);textproperty you're setting?