It's also possible as a one-liner in YUI, if that's what you're using:
Y.all('input').insert(' ','after');
Domanda
Just what it says,
Want to have this
$('input').after(" ");
in YUI, or if not possible in YUI then in pure javascript.
Thanks!
Soluzione
It's also possible as a one-liner in YUI, if that's what you're using:
Y.all('input').insert(' ','after');
Altri suggerimenti
Try following (http://jsfiddle.net/RCUcU/)
var nodes = document.querySelectorAll("input");
var text = "some text";
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
var textNode = document.createTextNode(text);
node.parentNode.insertBefore(textNode, node)
}
You will create text node (it isn't html element) https://developer.mozilla.org/en-US/docs/Web/API/document.createTextNode