samedi 25 juillet 2020

Toggle between two different tag contents using checkbox

HTML

<body class="music">
  <pre class="chord">Chords</pre>
  <div class="lyric" style="display: none">Lyrics</div>
  <input class="c" id="event" type="checkbox" checked data-toggle="toggle" data-size="small" width="5px" data-onstyle="info" data-offstyle="info" data-on="Chords" data-off="Lyrics">
</body>

Please help me with jquery code. By default only pre tag contents are displayed. When checkbox is checked I need to display only the contents of div tag. When box is unchecked, I want the reverse to be happened i.e. only show contents of pre tag.




Aucun commentaire:

Enregistrer un commentaire