Best 2 Know

The Ultimate Blogging Resource

  • Advertising
  • WebHosting
  • Contact Us
  • Blogger
    • Blogger Templates
    • Blogger Tutorials
  • Browser
    • Firefox
    • Google Chrome
  • Google
  • Internet
    • Facebook
    • Twitter
  • Thesis
  • Windows
  • WordPress
    • WordPress Themes
    • WordPress Plugins
  • More
    • Linux
    • Review
    • Solutions
    • Announcements

How To Show/Hide Text Using JavaScript Toggle Method


Show/Hide

This is Hidden Text


For this method there are two steps, one is to add a code to the template <Head> </Head> region, so that you can use this anywhere [in posts, as well as widgets]

Then the second part of the code has to wherever you want to display text / images in this way.

First Step:
Log in to Blogger, go to “Layout”, click on “Edit HTML” tab.
Now find for this code: </Head>

Then immediately BEFORE this code, paste this:

<script language=”javascript”>
function toggle() {
var ele = document.getElementById(“toggleText”);
var text = document.getElementById(“displayText”);
if(ele.style.display == “block”) {
ele.style.display = “none”;
text.innerHTML = “show”;
}
else {
ele.style.display = “block”;
text.innerHTML = “hide”;
}
}
</script>


Second Step:
Now wherever you want to show this type of text, add code like this:

<a href=”javascript:toggle();” id=”displayText”>Show/Hide</a>
<div id=”toggleText” style=”display: none;”>This is Hidden Text</div>


here’s the method to add this hack two times in your blog !

Once you have done the process described above, do this:

Third Step:
Log in to Blogger, go to “Layout”, click on “Edit HTML” tab.
Now find for this code: </Head>

Then immediately BEFORE this code, paste this:

<script language=”javascript”>
function toggle2() {
var ele = document.getElementById(“toggleText”);
var text = document.getElementById(“displayText”);
if(ele.style.display == “block”) {
ele.style.display = “none”;
text.innerHTML = “show”;
}
else {
ele.style.display = “block”;
text.innerHTML = “hide”;
}
}
</script>


Fourth Step:
Now wherever you want to show this type of text, add code like this:

<a href=”javascript:toggle2();” id=”displayText”>Show/Hide</a>
<div id=”toggleText” style=”display: none;”>This is Hidden Text</div>

Similarly you can add any number of times, by changing the code in red to toggle3(), toggle4() etc.
But if you add it many times, then it may slow down your blog !

Subscribe via Email

Share this:

  • Twitter
  • Facebook
  • Pocket
  • Print
  • Email

Related

March 19, 2009 Ritesh Sanap Blogger Tutorials, Solutions Blogger Hacks, Tutorials

Post navigation

Previous Previous post: Add Your Sign Below All Posts In Blogger / BlogSpot Blogs
Next Next post: How To Make Any Firefox Add-on Compatible with All Versions

Currently Trending

  • Windows Vista CD key
  • How to download Specific parts of YouTube videos
  • How to Increase Dropbox upload speed
  • How to add Attribution widget in blogger
  • How To Make Your Own Windows Media Player Theme
  • List Of All 255 Keyboard All Alt Key Codes
  • HORIZONTAL AND VERTICAL SPACING
  • How to Change the Welcome/Login Screen in Windows XP ?
  • Free Demonoid Invitation Code
  • How to create/Make Secret group in FaceBook

Random Posts

WordPress SEO Plugin by Yoast

June 22, 2011 By Ritesh Sanap 8 Comments

Basic PC shortcut keys

April 30, 2009 By Ritesh Sanap Leave a Comment

NewoosFormat – Blogger Template

August 8, 2010 By Ritesh Sanap 4 Comments

110 Amazing Magic Tricks with Everyday Objects – eBook

July 27, 2008 By Ritesh Sanap 1 Comment

Trily – Blogger Template

May 30, 2010 By Ritesh Sanap 28 Comments

WordPress

HTTP2 Server Push for W3 Total Cache Minify plugin

August 17, 2016 By Ritesh Sanap 5 Comments

How to Disable Emojis in WordPress

January 6, 2016 By Ritesh Sanap Leave a Comment

JetPack Related posts and Sharing not working with NGINX

November 10, 2015 By Ritesh Sanap Leave a Comment

Simply Pure – WordPress Theme

November 2, 2014 By Ritesh Sanap 2 Comments

Advanced What should we Write about next? – WordPress Plugin

July 28, 2014 By Ritesh Sanap Leave a Comment

How to Disable Self Pingback or TrackBack

January 16, 2014 By Ritesh Sanap Leave a Comment

BlueStrap – WordPress Theme

January 1, 2014 By Ritesh Sanap 15 Comments

How to Create Multiple Excerpts in WordPress

December 24, 2013 By Ritesh Sanap Leave a Comment

How to Disable Auto Update in WordPress

November 21, 2013 By Ritesh Sanap Leave a Comment

How to Delete Feedbacks from JetPack Contact Form

November 19, 2013 By Ritesh Sanap 9 Comments

Recent Posts

  • HTTP2 Server Push for W3 Total Cache Minify plugin
  • How to show hidden files and folders in Mac OS X
  • How to Disable Emojis in WordPress
  • Canva – Online Photo Editor
  • JetPack Related posts and Sharing not working with NGINX

Archives

Recommends

  • DigitalOcean – Cloud Hosting
  • Dropbox – Cloud Storage
  • Elegant Themes – WordPress Themes
  • LastPass – Password Manager
  • Like us on Facebook
  • Follow on Twitter
  • +1 on Google
  • Subscribe via Email
  • RSS Feed

© 2021 Best 2 Know · All Rights Reserved · We ♥ DigitalOcean

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.