attr - jQuery replacewith anchor tag to span tag -
I am trying to remove an anchor tag and have replaced it with a span tag but class etter I have this code But it is showing "undefined" for the square.
$ ("# wprmenu_menu"). Find ('li: is (ul) & gt; a'). Replacewith function () {var cathis = $ (this); Var classname = kithis.atrat ('class'); Return $ ("& lt; span class = \" "+ className +" \ "& gt;" + Qthis.html () + "& lt; / span & gt;");}); The anchor tag is removed, and the text lives inside, but does not transfer to the class.
Do not see anything in your code wrong. I have made a bus perception based on your selector. Changed the escape as well as single quotes. Not affecting the result ('Li: is (ul)); Replacewith (function () {var cathly = $ (this); var className = Qthis.attr ('class'); return $ ("& lt; span class = '" + className + "'>" + Qthis Html () + "& lt; / span & gt;");});
Comments
Post a Comment