toggle function javascript code example
Example 1: hide show toggle
$(document).ready(function() {
$("#btnshow").click(function() {
$("#imgshow").slideToggle();
});
})
Example 2: toggle element javascript
document.querySelector("#test").hidden = true;
document.querySelector("#test").hidden = false;