<!DOCTYPE html>
<html lang="en-US">
<head>
<style>
.one{
color:red
}
</style>
</head>
<body>
<p>Click on the button to add the class name ("one") to this paragraph.</p>
<button onclick="myFunction()">Click Me</button>
<script>
var elem = document.getElementsByTagName("p")[0];
function myFunction(){
elem.className="one";
}
</script> </body>
</html>