We would like to know how to target HTML element from a specific class of a BODY element.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.7.1.js'></script>
<style type='text/css'>
body {<!-- w ww . j a va 2 s.co m-->
width: 100%;
height: 100%;
}
</style>
<script type='text/javascript'>
$(function(){
$('body.specialPage').parent('html').css({'background-color': 'red'});
});
</script>
</head>
<body class="specialPage">
</body>
</html>
The code above is rendered as follows: