Treehouse: Grow your CSS skills. Land your dream job.

Last updated on:


jQuery(function () { 
    jQuery(":contains(FIND)").not(":has(:contains(FIND))").each(function () { 
        var that = $(this), 
            html = that.html(); 
        html = html.replace(/(\(FIND:.*?\))/g, "REPLACE-WITH"); 

Reference URL


  1. That is so over-complicated.

    • Permalink to comment#

      I think the only reasonable response to that is…
      “Put up or shut up.” Let’s see your alternative.

    • I would if I could work out how to post code into these comment blocks.

    • This would be javascript, so no special formatting is needed at all. Just put it in between <pre><code> tags. If it comes out fucked up, I fix it.

Leave a Comment

Posting Code

We highly encourage you to post problematic HTML/CSS/JavaScript over on CodePen and include the link in your post. It's much easier to see, understand, and help with when you do that.

Markdown is supported, so you can write inline code like `<div>this</div>` or multiline blocks of code in in triple backtick fences like this:

  function example() {
    element.innerHTML = "<div>code</div>";