70
rated 0 times
[
73]
[
3]
/ answers: 1 / hits: 46636
/ 10 Years ago, fri, october 24, 2014, 12:00:00
I'm trying to write text into an element span with function .text(), but I got this error
UncaughtTypeError: undefined is not a function, and I also tried function append(), innerHtml(), createTextNode() with no success.
What am I doing wrong?
var closeSpan = document.createElement(span);
closeSpan.setAttribute(class,sr-only);
closeSpan.text(Close); //UncaughtTypeError: undefined is not a function
OR
var closeSpan = document.createElement(span);
closeSpan.setAttribute(class,sr-only);
closeSpan.append(Close); //UncaughtTypeError: undefined is not a function
More From » jquery