Posts

Showing posts with the label Show/Hide

Simple Show/Hide Text using JavaScript

Image
This is a simple tutorial which explains how to show or hide lines in a paragraph using JavaScript. The concept is to split the lines in the paragraph into two sections and show/hide the second section by clicking a hyperlinked text (to create a toggle effect). By default, the first section in the paragraph is set to always visible, and a hyperlink at the end of the line with onclick action to display the second section . Similarly, a hyperlink at the end of the line of the second section with onclick action is displayed after a mouse click event to hide the second section . Example This is a simple tutorial which explains how to show or hide lines in a paragraph using JavaScript. <a style = 'text-decoration: none' id = 'show_line' href = 'javascript:void(0)' onclick = "document.getElementById('more').style.display = 'inline'; document.getElementById('hide_line').style.display = 'inline'; document.getElemen...