JSFiddle - React, Tailwind, and code Playground

HTML

<h1>Heading One</h1>
<p class="answ 1">This is first paragraph.</p>
<h1>Heading One</h1>
<p class="answ 2">This is first paragraph.</p>
<h1>Heading One</h1>
<p class="answ 3">This is first paragraph.</p>

CSS

p{display:none;}

JavaScript

(function(){

    // Crossbrowser function.
    evtUtility = {
				addEvent : function(el, type, fn){
						if(typeof addEventListener != 'undefined'){
							el.addEventListener(type, fn, false);
						} else if(typeof attachEvent != 'undefined'){
							el.attachEvent('on' + type, fn);
						} else {
							el['on'+type] = fn;
						}
					},
				
				removeEvent : function(el, type, fn){
						if(typeof removeEventListener != 'undefined'){
							el.removeEventListener(type, fn, false);
						} else if(typeof detachEvent != 'undefined'){
							el.detachEvent('on' + type, fn);
						} else {
							el['on'+type] = 'Null';
						}
					},
					
				getTarget : function(evt){
						if(typeof evt.target !== 'undefined'){
							return evt.target;
						} else {
							return event.srcElement;
						};
					},
					
				preventDefault : function(evt){
					
					(evt.preventDefault) ? evt.preventDefault() : evt.returnValue = false;
					
					},
				nextSiblings : function(el){
					if(typeof el.nextElementSibling !== 'undefined'){
						return el.nextElementSibling;
					} else {
						return el.nextSibling;
					}
				}
};
    
    // My function to open and close the p tag
    
    var para = null
    var evtDelegation = function(evt){
        var target = evtUtility.getTarget(evt);
        
        if(target.nodeName.toLowerCase() === 'h1'){
            if(para !== null) {
                para.style.display = 'none';    
            }
            para = evtUtility.nextSiblings(target);
            para.style.display = 'block';
        };
    };
	
	evtUtility.addEvent(document, 'click', evtDelegation);

})();