atjohns2
atjohns2

Reputation: 57

Get object by attribute in IE8

The following line works fine in IE9 but is giving me a 'Object doesn't support this property or method' error in IE8.

var id = $("td[title='Project Documents']");

Is there an IE8 compatible way to get an object based on a specific attribute?

Upvotes: 1

Views: 261

Answers (2)

ryanve
ryanve

Reputation: 52531

According to the docs what you have should work. Try this:

$("td[title]").filter(function () {
    return 'Project Documents' === $(this).attr('title');
});

It could be that the capitalization or whitespace chars do not match exactly.

Upvotes: 2

JoJo
JoJo

Reputation: 161

I'd be tempted to test this on a title without any whitespace in the title to test to see if it is actually this causing the problem.

Upvotes: 1

Related Questions