Saturday, November 26, 2011

jQuery contains() example

jQuery.contains() check to see true if both parameters are DOM nodes and the second parameter is contained inside the first.
Syntax:
$(“div:contains(jquery)”)
// selects all elements matched by that contains the text “jquery″.

Example:
$(“div:contains(‘jquery’)”).css(“color”, “red”);

No comments: