jQuery toggleText() Demo

Summary

The purpose of toggleText() is to provide a way to switch between to strings easily. I often come across cases where I have a link that toggles the view of an element and I would like the link to switch from saying "View element" to "Hide element."

View blog post

Demo

	$("#demo a").click(function(){
		$(this).toggleText("View", "Hide").next().toggle();
		return false;
	});
				
View Paragraph