text toggle in jquery code example
Example 1: toggle text jquery
$("button").click(function(){
$(this).text($(this).text() == 'Show' ? 'Close' : 'Show');
});
Example 2: jquery toggle text on click
$(function(){
$(".pushme").click(function () {
$(this).text(function(i, text){
return text === "PUSH ME" ? "DON'T PUSH ME" : "PUSH ME";
})
});
})