Untitled

mail@pastecode.io avatar
unknown
javascript
7 months ago
693 B
4
Indexable
Never
document.addEventListener('DOMContentLoaded', function () {
    
    document.querySelector('.user-input').addEventListener('input', addText);
    document.querySelector('.change-style').addEventListener('click', addStyle);

    function addText () {
        let inputText = document.querySelector('.user-input').value;
        let outputText = document.querySelector('.user-output');
        outputText.textContent = inputText;
    }

    function addStyle () {   
        let selectStyle = document.querySelector('.options').value;
        let outputText = document.querySelector('.user-output');
        outputText.classList.add(selectStyle);

        addText();
    }
});
Leave a Comment