Maybe try a filter function:
var filters = $('div').filter(function() {
return this.style.filter;
}).length;
alert(filters);
It won't work in FF because filter is IE-proprietary. Has nothing to
do with jQuery. To test, try this:
var divs = document.getElementsByTagName('div');
for (var i=0; i < divs.length; i++) {
(window.console && console.log) ?
console.log(divs[i].style.filter + ' ' +
divs[i].style.width) :
alert(divs[i].style.filter + ' ' + divs[i].style.width);
}
...and look in the Firebug console if you have it.
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Apr 15, 2009, at 5:57 AM, Tao wrote:
Hi,
I have the follow simple html code:
<div style="FILTER: progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr=#FFFFFFFF, EndColorStr=#7E003366);
WIDTH: 794px; HEIGHT: 685px">
Hello
</div>
And I try to use follow code to get the div element:
alert($('div[style*=FILTER]').length);
In Google Chorme, it return 1, but on other browsers IE8, FF3, Opera9,
all return 0.
Any suggestion?
Cheers,