๐Ÿ’ซ ์•Œ๋ฆผ์ฐฝ ๋„์šฐ๊ธฐ, ์ง€์šฐ๊ธฐ

See the Pen
์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ž…๋ฌธ
by dozzs (@dozzs)
on CodePen.

document.getElementById().style์„ ์ด์šฉํ•˜์—ฌ ํŠน์ • id๋ฅผ ๊ฐ€์ง„ HTML ํƒœ๊ทธ(์š”์†Œ)์˜ ์Šคํƒ€์ผ์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋‹ค.

document.getElementById('alert').style.display == 'none' : X๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ์‚ฌ๋ผ์ง ์ฒ˜๋ฆฌ

document.getElementById(find()).style.display = 'flex' : ๋„์šฐ๊ธฐ ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ๋ณด์ด๊ฒŒ ์ฒ˜๋ฆฌ

function find() {
        if(document.getElementById('alert').style.display == 'none')
            return 'alert';
        else if(document.getElementById('alert1').style.display == 'none')
            return 'alert1';
        else if(document.getElementById('alert2').style.display == 'none')
            return 'alert2';
        else
            return '';
    }
    if(find() != '')document.getElementById(find()).style.display = 'flex';

if๋ฌธ์„ ์ด์šฉํ•˜์—ฌ ์ˆœ์„œ๋Œ€๋กœ ์ผœ์ง€๋„๋ก ๋„์šฐ๊ธฐ ๋ฒ„ํŠผ ์ƒ์„ฑ

By Dozzing

๋‹ต๊ธ€ ๋‚จ๊ธฐ๊ธฐ

์ด๋ฉ”์ผ ์ฃผ์†Œ๋Š” ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ํ•„๋“œ๋Š” *๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค