Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- JPA
- s3 log ์ ์ฅ
- redis ํ ์คํธ์ฝ๋
- aws saa ํฉ๊ฒฉ
- ์๋ฐ
- aws ์ฟ ํฐ
- Codedeploy ์ค๋ฅ
- ๋ค์ค ์ปจํ ์ด๋
- docker compose
- prod docker-compose
- ์ ํจ์ค ์ค์ผ์ค๋ฌ
- redis ์กฐํ
- AWS Certified Solutions Architect - Associate
- docker ps -a
- docker-compose kafka
- Kafka
- ํ๋ก๊ทธ๋๋จธ์ค ์ปฌ๋ฌ๋ง๋ถ
- docker
- ํ์ดํผ๋ฐ์ด์
- ์๋ฒ ํฐ์ง๋ ๋์ปค ์ฌ์คํ
- nGrinder
- ์ ํจ์ค ๋น๋ ์ค๋ฅ
- ์คํํ๋ ๋ฏธ์ค
- private subnet ec2 ๋ก์ปฌ ์ ์
- Entity
- @RestControllerAdvice
- s3 ์ด๋ฏธ์ง ๋ค์ด๋ก๋
- ํ๋ก๊ทธ๋๋จธ์ค
- s3 ์ด๋ฏธ์ง ์ ์ฅ
- ํ๋ก๊ทธ๋๋จธ์ค ํฉ์นํ์์๊ธ
Archives
- Today
- Total
๐๐ข๐๐ โ๐๐๐ ๐๐๐ก๐๐ ๐๐๐๐โง
[JavaScript] Ajax๋ฅผ ํ์ฉํ ๋ฒํผ ๊ฐ ๋๊ธฐ๊ธฐ ๋ณธ๋ฌธ
๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ด๐ป/๐๐๐ฏ๐๐๐๐ซ๐ข๐ฉ๐ญ
[JavaScript] Ajax๋ฅผ ํ์ฉํ ๋ฒํผ ๊ฐ ๋๊ธฐ๊ธฐ
๐คRyusun๐ค 2023. 1. 23. 16:23ajax๋ฅผ ํ์ฉํ์ฌ ๋ฒํผ์ ๋ง๋ ํ ๋ณ๊ฒฝ๋ ์ฝ๋๋ก ์ธํด ๋ฒํผ์ด ์ ๋๋ฌ์ง๋ ํ์์ด ์๊ฒผ์์ต๋๋คใ ....
์๋ก ์ฌ๋ฌ๊ฐ์ ๋ฒํผ์ด ๋ง๋ฆ์ผ๋ก์จ ์๋์ class ๊ฐ์ queryselectAll๋ก ์ธ์์ด ์ ๋๋ ์ด์ ์๋๋ฐ
์ฝ์ง์ ํ๋ฃจ๋์ ํํ ํด๊ฒฐ๋ฒ์ ์ฐพ์์ ๊ณต์ ํฉ๋๋ค^.ใ
์ ์ ์ฝ๋
const reserveTimeWant = document.querySelectorAll('.reserve-time-want');
reserveTimeWant.forEach(list => {
list.addEventListener('click', function() {
const reserveTimeActive = document.querySelectorAll('.reserve-time-active');
reserveTimeActive.forEach(li => {
li.classList.remove('reserve-time-active');
});
console.log('reserve-time-active');
list.classList.add('reserve-time-active');
console.log(list.innerHTML);
inputRunningTime.value = list.innerHTML;
});
});
ajax๋ฅผ ํ์ฉํ๋ฉด ์๋ก ๋ง๋ค์ด์ง ๋ฒํผ์ class๊ฐ์ queryselectAll๊ฐ ์ธ์์ ๋ชปํ๊ฒ ๋ฉ๋๋ค.
ํด๊ฒฐ๋ฒ์ ๊ฐ๋จํ๋ฐ ๋ฒํผ์ด ํ๋๋ผ๋ฉด
$(document).on('click', 'class or id๊ฐ', function() {
์ ์ฝ๋๋ก ํด๊ฒฐ์ด ๊ฐ๋ฅํ๋ฉฐ ์๋ก ์๊ธด ๋ฒํผ์ด ์ฌ๋ฌ ๊ฐ์ด๋ฉด
$(document).on('click', '.reserve-time-want', function() {
$(this).each(function(){
$(this).each(function() {
์ฝ๋๋ฅผ ์ถ๊ฐํจ์ผ๋ก์จ ๋ฒํผ์ ๋๋ฅผ ๋ ๊ฐ๊ฐ์ ๊ฐ๋ค์ ๋๊ธฐ๊ฒ ๋ฉ๋๋ค.
๋ณ๊ฒฝํ ์ฝ๋
$(document).on('click', '.reserve-time-want', function() {
$(this).each(function(){
const reserveTimeActive = document.querySelectorAll('.reserve-time-active');
reserveTimeActive.forEach(li => {
li.classList.remove('reserve-time-active');
});
this.classList.add('reserve-time-active');
console.log(this.innerHTML);
inputRunningTime.value = this.innerHTML;
});
});