JSFiddle - React, Tailwind, and code Playground
by hamix
HTML
<a class='courselink' href=somelink.com>
Some content
</a>
<a class='courselink' href="somelink.com">
http://www.somelink.com
Some content
</a>
<a class='courselink' href="somelink.com">
Some content
</a>
<a href=# class='vieweditlink'>Edit</a>
CSS
.moveUrl{color :red;}
JavaScript
var edit = false;
$('.courselink').click(function(e){
if(edit == true){
e.preventDefault();
}
});
$('.vieweditlink').click(function(){
if($(this).html() == 'Edit'){
$("a").html(function(index,elm){
$(this).html($(this).text().replace( /(http:\/\/[^\s]+)/gi , '<a class ="moveUrl" href="$1">Url move to a tag</a>'));
});
edit = true;
}
else {
edit = false;
}
});