Skip to content

Commit

Permalink
textColorChanger
Browse files Browse the repository at this point in the history
  • Loading branch information
anbuleo committed Dec 4, 2024
1 parent d798354 commit 9903bf0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ let rectDiv = document.createElement("div")
let cirDiv = document.createElement("div")

let btnDiv = document.createElement('div')
let ResetDiv = document.createElement('div')
let btnReset = document.createElement('button')

btnReset.innerText = 'Reset'


let btn1 = document.createElement('button')
Expand All @@ -70,6 +73,7 @@ for(let i in btnStyle){
btn1.style[i] = btnStyle[i]
btn2.style[i] = btnStyle[i]
btn3.style[i] = btnStyle[i]
btnReset.style[i]= btnStyle[i]
}


Expand All @@ -94,8 +98,10 @@ btn.forEach((e)=>{
btn1.addEventListener("click",()=>changeColor('Green'))
btn2.addEventListener("click",()=>changeColor('Red'))
btn3.addEventListener("click",()=>changeColor('Blue'))
btnReset.addEventListener("click",()=>changeColor('white'))

let color = ['Green', 'Red', 'blue']

let color = ['Green', 'Red', 'blue',]


let changeColor = (color)=>{
Expand Down Expand Up @@ -143,12 +149,15 @@ rectDiv.appendChild(cirDiv)

//map to append more child in one div
arrBtn.map(e=>btnDiv.appendChild(e))
ResetDiv.appendChild(btnReset)

divContainer.appendChild(divContainerH1)
divContainer.appendChild(inputDiv)
divContainer.appendChild(rectDiv)
divContainer.appendChild(btnDiv)

divContainer.appendChild(ResetDiv)




Expand Down

0 comments on commit 9903bf0

Please sign in to comment.