SoFunction
Updated on 2025-02-28

Explanation of the role of jQuery greater than (>) selector


<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<title>Ant Tribe</title>
<style type="text/css">
#box{
  width:300px;
  height:200px;
  background:black;
}
#middle{
  width:200px;
  height:150px;
  background:red;
  margin:0px auto;
}
#inner{
  width:100px;
  height:100px;
  background:blue;
  margin:0px auto;
}
</style>
<script src="/jquery/1.9.0/"></script>
<script>
$(document).ready(function(){
  $("#box>div").css("background-color","green");
});
</script>
</head>
<body>
<div >
  <div >
    <div ></div>
  </div>
</div>
</body>
</html>