JSFiddle - React, Tailwind, and code Playground

by stecb

HTML

<a id="mya" href="http://www.example.com">old text</a>

JavaScript

$('mya').store('toggled',false);

$('mya').addEvent('click',function(event){
    event.stop();
    if(this.retrieve('toggled')){
        this.set('html', 'old text');
    }else{
        this.set('html', 'new text');
    }
    this.store('toggled',!(this.retrieve('toggled')));
});