Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

wrapping a span tag with an a tag with a href target same as the text of the span

$(".myClass").each( function() {
  $(this).wrap('<a href="http://www.example.com/' + $(this).text() + '" onclick="myfunc();" />');
});

console.log($(".myClass").parent())
 
PREVIOUS NEXT
Tagged: #wrapping #span #tag #tag #href #target #text #span
ADD COMMENT
Topic
Name
2+6 =