Relax Breath of Solution.Community tech blog of Sameera Thilakasiri - Consultant UI, UX, RWD Specialist/ Interactive Designer

Just I wanted.. Do you?…

jQuery content Filter

Posted on September 4, 2011 | Comments Off on jQuery content Filter

: contains() Selector

It filters the elements which have the matched text.
Example :


It filters the div which have ‘Ankit’ as text and underline them.

: empty Selector
It filters the elements which are empty. Here empty means they don’t have children or text.
Example :


It filters all the ‘td’ element which don’t have any child or text and fill it with text “Was empty” and change it’s background color.

:has() Selector
It filters the elements which contains the element provided to ‘ has() ‘.

Example :


It filters all the ‘div’ elements which have ‘p’ (paragraph) inside it and add the css class ‘test’ to it.

: parent Selector
It selects all the elements that have at least one child including text .

<body>
<table border="1">

<tr><td>Ankit</td><td></td></tr>
<tr><td>Vinita</td><td></td></tr>

</table>
<script>$("td:parent").fadeTo(1500, 0.3);</script>
</body>

Author
Sameera Thilakasiri By Sameera Thilakasiri
,is a front-end developer based in Colombo, is a blogger and a lifestyle photographer.
Follow him Twitter and Google+. Check out him.

Comments

Comments are closed.