javascript
  • html
  • css
  • 2015-09-20 28 views 0 likes 
    0

    我有這個div
    這個功能Javascript函數.toggle開始隱藏?

    <div id="audio1" style='display:none; > 
        $(document).ready(function() { 
         $("#p1").on("click", function() { 
          $("#audio1").toggle(1500); 
    
          }); 
        }); 
    

    我在哪裏需要把隱藏()。

    +0

    使用隱藏'method'裏面的文件蠢蠢欲動的隱藏元素默認或使用css'display:none' – tkay

    +0

    那麼,你必須首先執行'$('#audio1「)。hide()'。 – victor175

    回答

    1

    我不知道顯示器的像這樣的用法:

    <div id="audio1" display="none" > 
    

    你應該這樣做:

    <div id="audio1" style="display: none;" > 
    

    OR

    $('#audio1').hide(); 
    
    2

    隱藏()使得它的風格顯示等於無

    顯示() 隱藏之間3210

    撥動開關()等如果u要隱藏和顯示切換使用其他合理利用隱藏

    <html><head></head><body> 
    
    <p>Click the button to display a random number.</p> 
    
    <button onclick="myFunction()">Try it</button> 
    
    <p id="demo" style="width:100px; height:100px; background-color:blue; display: block;"></p> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> 
    <script> 
    
        function myFunction() { 
         $('#demo').toggle(); 
        } 
    </script> 
    
    
    
    </body></html> 
    
    相關問題