Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
<head>
<style type="text/css">
.highlight { 
background:green;
}
</style>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
</head>
<body>
<h1>jQuery add / remove css class example</h1>
 
<p id="para1">This is paragraph 1</p>
<p>This is paragraph 2</p>
<p>This is paragraph 3</p>
<p>This is paragraph 4</p>
 
<button id="addClass">Add highlight</button>
<button id="removeClass">Remove highlight</button>
 
<script type="text/javascript">
 
$("#addClass").click(function () {
 
$('#para1').addClass('highlight');
 
});
 
$("#removeClass").click(function () {
 
$('#para1').removeClass('highlight');
 
});
 
</script>
</body>
</html> - See more at: http://www.developer.am/documentation/jQuery/?page=how-to-add-remove-css-class-dynamically-in-jquery#sthash.6pL82tb2.dpuf
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers