Created
March 16, 2018 21:33
-
-
Save tylerzey/df6a9ce0547e58da0db2a46f83e57f72 to your computer and use it in GitHub Desktop.
adding / removing class with js for s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<div class="class tyler">This has class tyler</div> | |
<div class="class sophia">This shas class Sophia</div> | |
<script type="text/javascript"> | |
'use strict'; | |
let tyler = document.querySelector('.tyler'); | |
let sophia = document.querySelector('.sophia'); | |
tyler.classList.remove('class'); | |
sophia.classList.add('newclass'); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment