How to Show hide content using core JavaScript ?

Today I was working on another website and had very long text/content and thought to use Jquery, there are several examples given on internet. I tried to use some of them of course they are very simple but because of some reason it didn’t work for me either in IE and chrome.
So decided to compile my own show hide JavaScript which is based on DOM!
Here is very simple code and it works everywhere, Firefox, Internet Explorer, Chrome, Safari etc.

Steps are self explanatory.
A. Use JavaScript code
B. Use Css Class
C. See the example and compile your own!




This is first paragraph of my big content. Click to See more.

Here is your hidden text which you want to hide!! Copy your text here!

Click to hide this content.

Share

4 thoughts on “How to Show hide content using core JavaScript ?

  1. JC

    The class style needs to be modified to be case sensitive in order to work properly:

    .more-PM {
    display: none;

    This is a slick and easy technique, thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *