I apologize if this question is asked, but after a few hours of searching, I could not find the solution.
I have a snippet of JavaScript, which allows the block of text to be hidden until the user clicks the Read More button.
After the problem I need to change the input value attribute after the fall and to read.
Javascript:
function bundle m (a) {var e = document.getElementById (a); If (! E) come back true; If (e.style.display == "none") {e.style.display = "block" document.getElementsById ("toggle"). Value = "Read less"} and {e.style.display = "none" Document.getElementsById ("Toggle"). Value = "Read more"} be true; }
& lt; P & gt; Lorem Ipsum is simply the dummy text of the printing and typesetting industry. Lorem Ipsum has ever been the standard dummy text of the industry since the 1500s, when a galley of an unknown printer type was taken and fried to create a type of sample book. It is not left for only five centuries, but there is a leap in electronic type-sitting, essentially unchanged balance. It became popular in the 1960s with the release of Letraset Sheets with the Larem Ipsom route, and recently with the release of desktop publishing software such as Elleads PageMaker, such as Lorem Ipsum. & Lt; / P & gt; & Lt; Div id = "read" style = "display: none" & gt; & Lt; P & gt; Contrary to popular belief, Lorem Ipsum is not just a random text. It has roots in a piece of classical Latin literature from 45 BC, making it 2000 years old. Richard McLinentock, a Latin professor at Humpden-Sydney College of Virginia, saw a more obscure Latin word pictureture from the Lorum Epsom, and after discovering the word in classical literature, discovered the unreliable source. Written in Lorim Ipsum 45 BC, Coming from section 1.10.32 and 1.10.33 of "De Finishous Bonorum and Malorum" (The Good and Evil Extreme) by Cicero. This book is a treatise on the principle of ethics, which is very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet ..", comes from a line in section 1.10.32. & Lt; / P & gt; & Lt; / Div & gt; & Lt; Br / & gt; & Lt; Input id = "toggle" type = "button" onclick = "return toggle ('read')" value = "read more" & gt; As you can see from the snippet above I am running into a problem where I do not know correctly
Just a typo:
should be document.getElementsById ()
:
document.getElementById ( ) When your Javascript code does not work, before this it is a best practice to take a look at your console: P>
In your case, this exception has been thrown. If you click on the correct link js: 25
then it is directly on the getElementsById
function.
No comments:
Post a Comment