Javascript change Div style

后端 未结 7 1761
轻奢々
轻奢々 2021-01-03 18:30

I want that part 1 onclick div style changes and part 2 again on click it comes back to normal. I tried doing so but I failed to achieve the

7条回答
  •  情书的邮戳
    2021-01-03 18:49

    you may check the color before you click to change it.

    function abc(){
         var color = document.getElementById("test").style.color;
         if(color==''){
             //change
         }else{
             //change back
         }
    }
    

提交回复
热议问题