JSFiddle - React, Tailwind, and code Playground

by joydesigner

HTML

<a href="#">click me and change to text</a>

JavaScript

$("a").on('click',function(){
   
    var $lnk = $(this);
   
    var $replace = $('<span>');
    $replace.text($lnk.text());
    // Link to Text
    $lnk.replaceWith($replace);
    // Text to Link
    $replace.one('mouseout',function(e){
         
        $replace.replaceWith('<a href="#">test</a>');
    });
    
     e.preventDefault();
    return false;
   
});