Speed up your Oxygen workflow

with Swiss Knife Pro

A true Oxygens Editor Enhancer
Lifetime Deal Only $40

Toggle text inside div

jQuery Snipped for toggle text inside div on click.

"Hello World" will be default text and text for every second click.
And "Bye!" will be on first and every even click.

jQuery.fn.extend({
    toggleText: function (a, b){
        var isClicked = false;
        var that = this;
        this.click(function (){
            if (isClicked) { that.text(a); isClicked = false; }
            else { that.text(b); isClicked = true; }
        });
        return this;
    }
});

jQuery('.toggle-text').toggleText("Hello World", "Bye!");

If you need help with custom scripts or you are not skilled enough to implement something from the tutorial?

HIRE ME

Stay up to date with latest post and updates.