javascript display show code example

Example 1: js hide div

//If you have jquery, you can use the following method:
$("#mydiv").hide(); //hides div.
$("#mydiv").show(); //shows div.
//If you don't have jquery...
//search up the following: html how to add jquery

Example 2: js display

Check this! https://dev.to/devlorenzo/js-hide-and-show-32og

Example 3: javascript hide a div

<div id="main"> 
  <p> Hide/show this div </p>
</div>

('#main').hide(); //to hide

// 2nd way, by injecting css using jquery
$("#main").css("display", "none");

Example 4: toggle element javascript

document.querySelector("#test").hidden = true;
document.querySelector("#test").hidden = false;

Example 5: how to display ä in js

// Ü, ü     \u00dc, \u00fc
// Ä, ä     \u00c4, \u00e4
// Ö, ö     \u00d6, \u00f6
// ß        \u00df

Tags:

Html Example