Skip to content

Instantly share code, notes, and snippets.

@amiel
Created May 11, 2009 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amiel/110219 to your computer and use it in GitHub Desktop.
Save amiel/110219 to your computer and use it in GitHub Desktop.
$.fn.text_without_children = function(selector) {
var tmp = $("<div></div>").html(this.html()),
collection = (typeof selector == 'undefined') ? tmp.children() : tmp.find(selector);
collection.remove();
return tmp.text();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment