[JavaScript] input ํƒœ๊ทธ disabled ์†์„ฑ์„ ์ด์šฉํ•œ ๋ฒ„ํŠผ ํ™œ์„ฑํ™”/๋น„ํ™œ์„ฑํ™”
ยท
Frontend/JavaScript
๊ฒฝ๋งค ์„œ๋น„์Šค ํ”„๋กœ์ ํŠธ๋ฅผ ํ•˜๋‹ค๋ณด๋‹ˆ ์ƒํ™ฉ์— ๋”ฐ๋ฅธ ๋ฒ„ํŠผ ๋น„ํ™œ์„ฑํ™”๊ฐ€ ํ•„์š”ํ•˜์˜€๊ณ , ์ด๋ฅผ ์œ„ํ•ด ๊ธฐ๋ณธ์ ์ธ ๋ฒ„ํŠผ ๋น„ํ™œ์„ฑํ™” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์•˜๋‹ค. input ํƒœ๊ทธ ๋‚ด์— disabled ์†์„ฑ ์‚ฌ์šฉSee the Pen button disabled by SeongHo-C (@seongho-c) on CodePen. input ํƒœ๊ทธ์— disabled ์†์„ฑ์„ ๋”ฐ๋กœ ๋ช…์‹œํ•˜์ง€ ์•Š์œผ๋ฉด, ๋ฒ„ํŠผ์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ํ™œ์„ฑํ™” ์ƒํƒœ๊ฐ€ ๋œ๋‹ค.input ํƒœ๊ทธ์— disabled ์†์„ฑ์„ ๋ช…์‹œํ•ด ์ฃผ๋ฉด, ๋ฒ„ํŠผ์€ ๋น„ํ™œ์„ฑํ™” ์ƒํƒœ๊ฐ€ ๋œ๋‹ค. ํ™œ์„ฑํ™”/๋น„ํ™œ์„ฑํ™” ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ ๋ฒ„ํŠผ์˜ ์ƒํƒœ ๋ณ€๊ฒฝSee the Pen button click disabled by SeongHo-C (@seongho-c) on CodePen. [JAVASCRIPT]const target =..
[JavaScript] ํ˜„์žฌ ์‹œ๊ฐ„๊ณผ ๋น„๊ตํ•ด ๋‚จ์€ ์‹œ๊ฐ„ ๊ตฌํ•˜๊ธฐ(์ผ, ์‹œ, ๋ถ„, ์ดˆ)
ยท
Frontend/JavaScript
ํ˜„์žฌ ์‹œ๊ฐ„๊ณผ ๋งˆ๊ฐ ๊ธฐ๊ฐ„์„ ๋น„๊ตํ•ด ๋‚จ์€ ์‹œ๊ฐ„ ๊ตฌํ•˜๊ธฐfunction remaindTime(endDate) { // ํ˜„์žฌ ์‹œ๊ฐ„์„ ๊ตฌํ•œ๋‹ค. const now = new Date(); // ๋งˆ๊ฐ ๊ธฐ๊ฐ„์„ ๊ฐ€์ ธ์˜จ๋‹ค. const end = new Date(endDate); // ํ˜„์žฌ ์‹œ๊ฐ„์„ ms๋กœ ๋ฐ˜ํ™˜ํ•œ๋‹ค. const nt = now.getTime(); // ๋งˆ๊ฐ ๊ธฐ๊ฐ„์„ ms๋กœ ๋ฐ˜ํ™˜ํ•œ๋‹ค. const et = end.getTime(); // ๋งˆ๊ฐ ๊ธฐ๊ฐ„์ด ํ˜„์žฌ ์‹œ๊ฐ„๋ณด๋‹ค ํด ๊ฒฝ์šฐ if (nt  ์ถœ๋ ฅ ๊ฒฐ๊ณผํ˜„์žฌ ์‹œ๊ฐ„: Tue Jul 23 2024 16:09:33 GMT+0900 (Korean Standard Time) ๋‚จ์€ ์‹œ๊ฐ„: 365์ผ 00์‹œ๊ฐ„ 00๋ถ„ 26์ดˆ
[JAVASCRIPT] Fetch API & FormData๋ฅผ ์ด์šฉํ•œ ๋‹ค์ค‘ํŒŒ์ผ ์—…๋กœ๋“œ
ยท
Frontend/JavaScript
โ— ์ƒํ’ˆ ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ๋ฅผ ์œ„ํ•œ HTML ์ƒํ’ˆ ์ด๋ฏธ์ง€ ๋“ฑ๋ก ํƒœ๊ทธ์˜ enctype ์†์„ฑ๊ฐ’์€ multipart/form-data๋กœ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. โ€ป๋งค์šฐ ์ค‘์š”โ€ป ํƒœ๊ทธ์˜ multiple ์†์„ฑ์€ ์š”์†Œ์— ์‚ฌ์šฉ์ž๊ฐ€ ๋‘˜ ์ด์ƒ์˜ ๊ฐ’์„ ์ž…๋ ฅํ•  ์ˆ˜ ์žˆ์Œ์„ ๋ช…์‹œํ•ฉ๋‹ˆ๋‹ค. ํŒŒ์ผ์„ ์—…๋กœ๋“œ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํƒœ๊ทธ์˜ type ์†์„ฑ๊ฐ’์€ file๋กœ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. โ— ์ด๋ฒคํŠธ๋ฆฌ์Šค๋„ˆ ์ด์šฉ์„ ์œ„ํ•œ ํƒœ๊ทธ ๋“ฑ๋ก โ— Fetch API & FormData๋ฅผ ์ด์šฉํ•˜์—ฌ ์„œ๋ฒ„์— Request ์ „๋‹ฌ fetch() ํ•จ์ˆ˜๋Š” ์ฒซ๋ฒˆ์งธ ์ธ์ž๋กœ URL, ๋‘๋ฒˆ์งธ ์ธ์ž๋กœ Option ๊ฐ์ฒด๋ฅผ ๋ฐ›๊ณ , Promise ํƒ€์ž…์˜ ๊ฐ์ฒด๋ฅผ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค. URL์€ ํ•„์ˆ˜ ๋งค๊ฐœ๋ณ€์ˆ˜ ์ž…๋‹ˆ๋‹ค. ๋ฐ˜ํ™˜๋œ ๊ฐ์ฒด๋Š”, API ํ˜ธ์ถœ์ด ์„ฑ๊ณตํ–ˆ์„ ๊ฒฝ์šฐ response ๊ฐ์ฒด๋ฅผ resolveํ•˜๊ณ , ์‹คํŒจํ–ˆ์„ ๊ฒฝ์šฐ error ..
_์„ฑํ˜ธ_
'Frontend/JavaScript' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (2 Page)