Skip to content

Instantly share code, notes, and snippets.

@zhouxiaozhen-github
Created April 18, 2019 07:32
Show Gist options
  • Save zhouxiaozhen-github/a2e4de8d97c2894aa5cb1c950d20bc37 to your computer and use it in GitHub Desktop.
Save zhouxiaozhen-github/a2e4de8d97c2894aa5cb1c950d20bc37 to your computer and use it in GitHub Desktop.
显示切换/display + toggle
<script src="https://cdn.bootcss.com/jquery/3.4.0/jquery.min.js"></script>

<h1 id='mico1' style='display: none'></h1>

<h1 id='mico2' style='display: block'>micomico</h1>

<button onclick="mico()">切换</button>

<script>
  function mico(){
    $("#mico1").toggle();
    $("#mico2").toggle();
  }
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment