contains is a pseudo-selector, but not a method. So you can use it like this:
html before: <p>the quick brown</p> <p>fox jumped over</p> <p>the lazy dog</p> script: $("p:contains('the')").remove(); html after: <p>fox jumped over</p> That doesn't really help in the scenario you've posed because contains searches the text of the element (see http://docs.jquery.com/Selectors/contains#text ). What you want is the attributeContains attribute selector. See: http://docs.jquery.com/Selectors Under "Attribute Filters" there is [attribute*=value] Matches elements that have the specified attribute and it contains a certain value. http://docs.jquery.com/Selectors/attributeContains#attributevalue So in your example that would be if ( $("#myimg[src*='expand']").length ) // do something else // do something else - Richard Richard D. Worth http://rdworth.org/ On Thu, Sep 25, 2008 at 11:21 PM, JQueryProgrammer <[EMAIL PROTECTED]>wrote: > > I have an image tag as > <img id="myimg" src="images/expand.jpg" /> > I am trying as > if($("#myimg").attr("src").contains("expand")) > // do something > else > //do something else > but it gives an error "Object doesn't support this property of > method". Please help. >