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

前端 未结 8 2088
青春惊慌失措
青春惊慌失措 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:46

    Try

    <script>
      function toggleTable()
        {
    
        var status = document.getElementById("loginTable").style.display;
    
        if (status == 'block') {
          document.getElementById("loginTable").style.display="none";
        } else {
          document.getElementById("loginTable").style.display="block";
        }
      }
    </script>
    
    0 讨论(0)
  • 2021-02-05 13:52

    Simple using jquery

    <script>
    $(document).ready(function() {
        $('#loginLink').click(function() {
        $('#loginTable').toggle('slow');
        });
    })
    </script>
    
    0 讨论(0)
提交回复
热议问题