jQuery Replace Specific Text

Glenn Glenn's Blog, Uncategorized 0 Comments

Sometimes you may want to replace the text in a specific div or element with something else. For example you are using an off the shelf script and don’t want to edit the core files, but it doesn’t meet your specific needs or brand.

The following is a very simple jQuery snippet that replaces specific text with something else:-


<script type="text/javascript">
 jQuery(document).ready(function(){  
  jQuery('.your-div:contains("Some Text")').text( "New Text" );
});
</script>

 

About the Author
jQuery Replace Specific Text jQuery Replace Specific Text 0da77002febbfe28d15144a57bbcc2c9 s 180 d mm r g

Glenn

A highly experienced WordPress Web Developer, Front-end and Back-end Developer & New Media Specialist with extensive knowledge of a wide spectrum of technologies in the Development and Creative Industries built up over a number of years.

Leave a Reply

Your email address will not be published. Required fields are marked *