views:

72

answers:

2

This doesn't work

if( $.browser.opera ){
    $("body").addClass('opera');
}

why?

+2  A: 

Have you tried

if( $.browser.opera ){
    $("body").attr("class", "opera");
}
c0mrade
Doesn't work... same...
Toktik
+1  A: 

There is no problem using addClass. When opera loads there is no 'opera' class in body when I view sourcecode, but when I add in CSS body.opera{display:none;} it's executed. So problem is in browser. Browser doesn't make jQuery changes in user visible source code of browser.

Toktik