javascript - YUI create div in every input[type=text] -
hi ~ pardon ignorance, i'm new yui3. create clear button in every input textbox. attempt create div , append every input text. attempt fail.
kindly need guidance here on code tried below..
thanks in advance!
yui().use("node", function(y) { y.all('input[type=text]').each(function(node) { var outerdiv = y.node.create('<div class="clrinput">x</div>'); outerdiv.setstyles({ position: absolute, left: node.get('offsetleft')+this.get('width')-10, top: node.get('offsettop'), width:node.get('width'), height:node.get('height') }) node.appendto(outerdiv); }); });
the reason why not seeing outerdiv
never becomes part of dom. it's created, , input
node append
ed it, outerdiv
never added dom.
node.appendto(outerdiv); y.one('body').append(outerdiv);
should solve that. check out your script line added.
Comments
Post a Comment