javascript - How to take html element without text? -
edit:
sorry bad explanation have:
var x = $("span", this).get( 0 ); var y = x.outerhtml
and give me: <span>'some text'</span>
want tag <span></span>
atributes. question how it?;p
thanks help!
the problem in code: var x = $("span", this).get( 0 ); <-- have parent (even tag name) , taking first child var y = x.outerhtml <-- here you're trying parent (you eant - tag name) :%
so, if know var x = $("span"... <---- string - can create string want
var tag = "span"; var x = $(tag, this).get( 0 ); var y = x.outerhtml; // dumbest way var result = '<'+tag+'>'+'<'+tag+'/>';
Comments
Post a Comment