Creating a “read more” link that extends the content on the page

后端 未结 10 2231
萌比男神i
萌比男神i 2021-01-03 06:06

I would like to create a read more link that would extend a paragraph already being shown to reveal the entire text on the same page. If this could be solves with HTML5 and

10条回答
  •  余生分开走
    2021-01-03 06:40

    You can do it, change the property of CSS via Javascript.

    element.style.display = 'block';
    

    JS code

    function read_more() {
    document.getElementById('hidden-first').style.display = 'block';
    }
    
    document.getElementById('read-more').addEventListener('click', read_more);
    

    See this code on JSfiddle

提交回复
热议问题