Search
 
SCRIPT & CODE EXAMPLE
 

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())
Comment

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

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

<span class='myClass'>aaa</span>
<span class='myClass'>bbb</span>
<span class='myClass'>ccc</span>
<span class='myClass'>ddd</span>
Comment

PREVIOUS NEXT
Code Example
Javascript :: How to use search/filter for HTML Divs generated from JSON data using JavaScript 
Javascript :: Add and remove required attribute based on whether it is visible or hidden 
Javascript :: mutexify 
Javascript :: Render JOSN in frontend 
Javascript :: upsert typeorm 
Javascript :: track call recording in facebook using elements 
Javascript :: JavaScript delete atray item 
Javascript :: node-mongodb-native keep collection 
Javascript :: p5 filter 
Javascript :: debouce with clear debounce function javascript 
Javascript :: filter number from string in javascript 
Javascript :: json query rails c 
Javascript :: clickable image full screen javascript 
Javascript :: ENOENT electron 
Javascript :: Example: How to use || operator to shorten the code. 
Javascript :: how to install ghost js 
Javascript :: how to get content disposition from header jquery 
Javascript :: reduxjs toolkit createaction 
Javascript :: confirming the end javascript 
Javascript :: how to get creator of inetarceton discordjs 
Javascript :: CUSTOM_ELEMENTS_SCHEMA 
Javascript :: ahead-of-time (AOT) compilation 
Javascript :: Enqueue jquery for TypeError: $.browser is undefined issue 
Javascript :: next.js api typescript 
Javascript :: backbone view 
Javascript :: How do I target and change the style of a different element when I click a button in react 
Javascript :: xor two hex strings js 
Javascript :: how to check leap year in javascript 
Javascript :: array splice 
Javascript :: javascript alarm 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =