tags:

views:

87

answers:

1

Hi,

The following jquery code works in firefox, but is returning undefined in IE:

$('someObject').attr("id")[0]

Why is that?

+9  A: 

Try

$('someObject').attr("id").charAt(0)

The [] indexer operator is not supported on strings in Internet Explorer. string::charAt() is the correct method to use.

DrJokepu
Yes this is correct! +1
Luca Matteis