I am trying to code a simple click to read more within a paragraph. I am sure this code worked to both show AND hide on click. When I try this now, it shows the hidden text, but will not hide it when I click again?
<div onclick="document.getElementById ('review').style.display=document.getElementById
('review').style.display='none' ? 'block':'none';">
<p>Click here to read our review</p>
<div id="review" style="display: none;">Review text goes here.</div>
Any ideas about how to achieve this with simple inline code?
Thanks
$('#review').toggle()document.getElementById('review').style.display='none' ? 'block':'none'is ASSIGNING the value 'none' with the single-equals, which will always be true and set 'block', you need a double- (or triple-) equals there:document.getElementById('review').style.display=='none' ? 'block':'none'