I need to find an element based on a specific css attribute. The css is applied inline and I can not use a class.
Is there anyway to achieve this i
I think you might be able to write a custom jQuery selector to do this.
For example, if you want to do select by certain style attribute, you can do:
jQuery.extend(jQuery.expr[':'], {
styleEquals: function(a, i, m){
var styles = $(a).attr("style").split(" ")
var found = false;
for (var i = 0; i < styles.length; i++) {
if (styles[i]===m[3]) {
found = true;
break;
}
}
return found;
}
});
Then it can be used in conjuction with any other selector you can select all input elements with certain style like this:
$('input:styleEquals('width=10px')')