[jQuery] attr() throws error

[jQuery] attr() throws error

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=953455718-04012007>When using the
following code:</SPAN></DIV>
<DIV><SPAN class=953455718-04012007></SPAN> </DIV>
<DIV><SPAN
class=953455718-04012007>alert($('#ContactSelect').attr('tabIndex'));</SPAN></DIV>
<DIV><SPAN class=953455718-04012007></SPAN> </DIV>
<DIV><SPAN class=953455718-04012007>I get [</SPAN><SPAN
class=953455718-04012007>TypeError: elem has no properties.] when ContactSelect
does not exist on the page.</SPAN></DIV>
<DIV><SPAN class=953455718-04012007></SPAN> </DIV>
<DIV><SPAN class=953455718-04012007>To avoid this error, I am doing
this:</SPAN></DIV>
<DIV><SPAN class=953455718-04012007></SPAN> </DIV>
<DIV>if ($('*').index(document.getElementById('ContactSelect'))!=-1) <SPAN
class=953455718-04012007>alert($('#ContactSelect').attr('tabIndex'));</SPAN></DIV>
<DIV><SPAN class=953455718-04012007></SPAN> </DIV>
<DIV><SPAN class=953455718-04012007>It seems to be a rather crude fix. 
Should the attr command be executing if the ContactSelect element cannot be
found?</SPAN></DIV>
<DIV><SPAN class=953455718-04012007></SPAN> </DIV>
<DIV><SPAN class=953455718-04012007>Thanks,</SPAN></DIV>
<DIV><SPAN class=953455718-04012007></SPAN> </DIV>
<DIV><SPAN class=953455718-04012007>~Jeremy</SPAN></DIV>
<DIV><SPAN class=953455718-04012007></SPAN> </DIV>
<DIV><SPAN class=953455718-04012007></SPAN> </DIV></BODY></HTML>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/