1. How To Check If An Element contains a certain class or element with has():
//jQuery 1.4.* includes support for the has method.
$("input").has(".mail").addClass("mail_icon");
2. How To Detect Any Browser:
Detect Safari (if( $.browser.safari)),
Detect IE6 and over (if ($.browser.msie && $.browser.version > 6 )),
Detect IE6 and below (if ($.browser.msie && $.browser.version <= 6 )),
Detect FireFox 2 and above (if ($.browser.mozilla && $.browser.version >= '1.8' ))
3. Always start the selection From an #id
The fastest selector in jQuery is the ID selector ($('#someid')).
This is because it maps directly to a native JavaScript method, getElementById().
Read More