jQuery add class

A simple example of a using the jQuery addClass() function.
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="jQuery example for Tizen"/>
    
    <title>jQuery example for Tizen</title>
    
<style>
	.red {
	    position:absolute;
		background:#DD0000;
		height:120px;
		width:150px;	
	}
</style>

  <script src="js/jquery-2.1.4.min.js"></script>

</head>
<body>

  <div id="sampleDiv">This DIV is red</div>

<script> 
	$("#sampleDiv").addClass("red");
</script>

</body>
</html>

Responses

0 Replies