How to toggle HTML text of an anchor tag using jQuery? I want an anchor that when clicked the text alternates between Show Background & Show Text
Show Background
Show Text
Perhaps I'm oversimplifying the problem, but this is what I use.
$.fn.extend({ toggleText: function(a, b) { $.trim(this.html()) == a ? this.html(b) : this.html(a); } });