John Magdy John Magdy -4 years ago 72
HTML Question

HTML/JQuery - Element Hiding by its ID

I need help hiding an HTML element with its ID example:

<p id="myelemnt">Hello all</p><script type="text/javascript">document.getElementById.hide("myelemnt");</script>`

i tried that method and another method too example:

<p class="myelemnt">Hello all</p><script type="text/javascript">$(".myelemnt");</script>

but both of them aren't working.

Answer Source

First approach:

document.getElementById("myelemnt").style.display = "none";

Second approach (jQuery):

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download