What can I use in jquery instead of document.createTextNode(' ') js line.
I'm trying to do sth like this :
js : divButtons.appendChild(document.createTextNode(' '));
jquery : $("#divButtons").append(?????);
What can I use in jquery instead of document.createTextNode(' ') js line.
I'm trying to do sth like this :
js : divButtons.appendChild(document.createTextNode(' '));
jquery : $("#divButtons").append(?????);
You can use append to append plain text:
$("#divButtons").append("Hello world")
However, if you only want to append a space, you have to use the entity:
$("#divButtons").append(" ")
There is no equivalent in jQuery for createTextNode. You can always use the DOM method, or write a jQuery wrapper around it. The closest thing you may be able to find is when creating new elements, you can specify the text part separately.
$('<div>', {
text: '<hello world>'
});