Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <button>Switch it</button>
- <p>Awesome</p>
- <script>
- var btn = document.querySelector('button');
- var txt = document.querySelector('p');
- btn.addEventListener('click', updateBtn);
- function updateBtn() {
- if (txt.textContent === 'Awesome') {
- txt.textContent = 'It\'s Not Awesome';
- } else {
- txt.textContent = 'Awesome';
- }
- }
- </script>
Add Comment
Please, Sign In to add comment