To toggle a text using jQuery you can use the following snippet.
Sample jQuery
jQuery.fn.toggleText = function(textOne, textTwo) {
return this.each(function() {
jQuery(this).text(jQuery(this).text() == textOne ? textTwo : textOne);
});
};
All the Code Snippets and Samples you need
To toggle a text using jQuery you can use the following snippet.
jQuery.fn.toggleText = function(textOne, textTwo) {
return this.each(function() {
jQuery(this).text(jQuery(this).text() == textOne ? textTwo : textOne);
});
};
You must be logged in to post a comment.
RT @CodeSnippetsNET: How to toggle a text using #jQuery http://t.co/uzZ7SsibFS #js #javascript #html #css #php #coding
RT @CodeSnippetsNET: How to toggle a text using #jQuery http://t.co/uzZ7SsibFS #js #javascript #html #css #php #coding
RT @CodeSnippetsNET: How to toggle a text using #jQuery http://t.co/uzZ7SsibFS #js #javascript #html #css #php #coding