<div class="container">
  <h2><a href="https://garysieling.github.io/jquery-highlighttextarea/" target="_blank">jQuery highlightTextarea</a> demo</h2>
  <div class="panel panel-default">
    <div class="panel-heading">
      <form class="row">
        <div class="col-xs-6">
          <div class="form-group">
            <label for="keyword">Search term:</label>
            <input type="text" class="form-control input-sm" value="Lorem" name="keyword" id="keyword">
          </div>
          There is no way to remove highlights with this plugin, so you can not update the search term or options dynamically. 
        </div>
        <div class="col-xs-6">
          <div class="form-group">
            <label for="color">Color:</label>
            <input type="text" class="form-control input-sm" value="#f1c40f" name="color" id="color">
          </div>
          <div class="form-group">
            <label for="caseSensitive" class="noTransform"><input type="checkbox" value="true" name="caseSensitive" id="caseSensitive" checked="checked"> caseSensitive</label>
          </div>
        </div>
      </form>
    </div>
    <div class="panel-body context">
      <textarea rows="5" cols="50" rows="5">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</textarea>
    </div>
    <div class="panel-footer">This example is part of the article <a href="http://www.sitepoint.com/10-jquery-text-highlighter-plugins/" target="_blank">10 jQuery Text Highlighter Plugins</a> on <a href="http://sitepoint.com/" target="_blank">SitePoint</a> by <a href="https://github.com/julmot" target="_blank">Julian Motz</a>.</div>
  </div>
</div>
/**
 * The following is not related to the plugin
 */
body {
  background: #fbfcfc;
}

.container {
  max-width: 700px;
}

.form-group {
  margin-bottom: 5px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
}

.form-group label.noTransform {
  text-transform: none;
}
$(function() {
  var $context = $(".context textarea");
  var $form = $("form");
  var $input = $form.find("input[name='keyword']");

  // Determine search term (plugin expects an array)
  var searchTerm = $input.val().split(" ");

  // Determine options
  var options = {
    "words": searchTerm
  };
  $.each($form.serializeArray(), function(i, element) {
    if (element.name === "keyword") {
      return;
    }
    var val = element.value;
    if (val === "true") {
      // Convert to boolean from string
      val = true;
    }
    options[element.name] = val;
  });

  // Highlight
  $context.highlightTextarea(options);

});

External CSS

  1. https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/sandstone/bootstrap.min.css
  2. https://cdn.rawgit.com/garysieling/jquery-highlighttextarea/master/jquery.highlighttextarea.css

External JavaScript

  1. https://code.jquery.com/jquery-2.2.3.js
  2. https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js
  3. https://cdn.rawgit.com/garysieling/jquery-highlighttextarea/master/jquery.highlighttextarea.js