Skip to content

Instantly share code, notes, and snippets.

@johnantoni
Created December 23, 2010 14:30
Show Gist options
  • Select an option

  • Save johnantoni/753047 to your computer and use it in GitHub Desktop.

Select an option

Save johnantoni/753047 to your computer and use it in GitHub Desktop.
jquery - determine element clicked on, if outside the post textbox clear the value
// jquery get mouse location
// clear post when lose focus
$("*", document.body).click(function (e) {
e.stopPropagation();
var domEl = $(this).get(0);
if (!$(domEl).closest("#newsfeed_post").length > 0) {
$("#newsfeed_post textarea").css("color", "#aaa").val("Write something here...");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment