how to toggle (hide/show) a table onClick of tag in java script

前端 未结 8 2119
青春惊慌失措
青春惊慌失措 2021-02-05 13:24

I want to show and hide (toggle) the

onClick event of the . this is my tag

&         


        
      
      
      
8条回答
  •  故里飘歌
    2021-02-05 13:37

    You are trying to alter the behaviour of onclick inside the same function call. Try it like this:

    Anchor tag

    Login
    

    JavaScript

    function toggleTable() {
        var lTable = document.getElementById("loginTable");
        lTable.style.display = (lTable.style.display == "table") ? "none" : "table";
    }
    

提交回复
热议问题