<!DOCTYPE HTML>
<
html
>
<
head
>
<
title
>
How to select all elements that contains
some specific CSS property using jQuery ?
</
title
>
<
script
src
=
</
script
>
</
head
>
<
body
style
=
"text-align:center;"
>
<
h1
style
=
"color:green;"
>
GeeksforGeeks
</
h1
>
<
p
id
=
"gfg"
style="font-size: 20px;
font-weight: bold;">
Click on the button to get the
ID's of selected elements having
same property value pair.<
br
>CSS-
'font-size: 20px'
</
p
>
<
button
onclick
=
"GFG_Fun();"
>
Click Here
</
button
>
<
p
id
=
"geeks"
style=
"font-size: 20px; font-weight: bold;
color: green;">
</
p
>
<
script
>
var down = document.getElementById('geeks');
function GFG_Fun() {
/* Using not method, which removes
the elements which don't matches
the property. */
var x = $('p').not(function() {
return $(this).css('font-size') != '20px';
});
down.innerHTML = "ID's of selected "
+ "elements are - <
br
>" + x[0].id
+ "<
br
>" + x[1].id;
}
</
script
>
</
body
>
</
html
>