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. Benjamin Mayo
    Permalink to comment#

    That is so over-complicated.

    • OldGuy
      Permalink to comment#

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

    • Benjamin Mayo
      Permalink to comment#

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

    • Chris Coyier
      Permalink to comment#

      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 triple backtick fences like this:

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

We have a pretty good* newsletter.