JavaScript Paragraph Toggle
Javascript Code
+ 0 likes
Please Register to submit score.
| Average Score | 8.0 |
| Scores Submitted | 3 |
| Date Added | Jun 25, 2008 |
| Last Updated | Jun 25, 2008 |
| Tags | javascript paragraph toggle |
Introduction
Put this into any html page, the put this code for the bit that's to be toggled;
| Code: |
| <p id="pname" style="display:none;">This is my shitty text lolz</p> |
Now there's the paragraph, you need a link to toggle it visible, or not.
| Code: |
| <a href="Javascript:toggle('pname');">Link Text</a> |
This is REALLY effective when you use CSS with it, and it looks really pro :P
Javascript Snippet:
JavaScript Paragraph Toggle
Posted on Jun 25, 2008 9:26 pm
Posted on Jun 25, 2008 9:26 pm
Nice. I have used this method on my forums already but never the less nice
8/10 - Someone will find this very useful, i would if i hadn\'t already done it ;)
8/10 - Someone will find this very useful, i would if i hadn\'t already done it ;)
Javascript Snippet:
JavaScript Paragraph Toggle
Posted on Jun 26, 2008 12:08 pm
Posted on Jun 26, 2008 12:08 pm
Excellent Script! Just what I was looking for on my website, but a few points:
A: Does not seem to work when within <div></div> tags
B: Is there anyway to hide the link text when it is clicked?
9/10 If there\'s a solution to those, 10 straight away!
A: Does not seem to work when within <div></div> tags
B: Is there anyway to hide the link text when it is clicked?
9/10 If there\'s a solution to those, 10 straight away!
Javascript Snippet:
JavaScript Paragraph Toggle
Posted on Jun 26, 2008 1:56 pm
Posted on Jun 26, 2008 1:56 pm
No, i found it only worked with <p> not sure about <span> and as you say, doesnt work with <div>
I\'ll check it out and get back to you, but i am a JS idiot lol.
You could put the link text within a <p> so for instance;
that should work.
I\'ll check it out and get back to you, but i am a JS idiot lol.
You could put the link text within a <p> so for instance;
| Code: |
| <p id=\"paralink\" style=\"display:inline;\"><a href=\"Javascript: toggle(\'para\'); toggle(\'paralink\');\">Toggle</a></p> <p id=\"para\" style=\"display:none;\">This is my shoot text lolz</p> |
that should work.
Javascript Snippet:
JavaScript Paragraph Toggle
Posted on Jun 26, 2008 5:01 pm
Posted on Jun 26, 2008 5:01 pm
vaseline,
regarding the \"doesn\'t seem to work when within <div></div> tags\" i just tried it and it worked, perhaps post what you were trying and we could help
regarding the \"doesn\'t seem to work when within <div></div> tags\" i just tried it and it worked, perhaps post what you were trying and we could help
Javascript Snippet:
JavaScript Paragraph Toggle
Posted on Jun 28, 2008 11:46 am
Posted on Jun 28, 2008 11:46 am
Simple as what I said, I tried to put it within <div></div> tags and no text showed up. It seems to have not worked for jonesy44 either.
Javascript Snippet:
JavaScript Paragraph Toggle
Posted on Jun 28, 2008 11:17 pm
Posted on Jun 28, 2008 11:17 pm
so you have
or
or what?
????
| Code: |
<div>Code & text here</div> |
or
| Code: |
Code here <div> text here</div> |
or what?
????
Javascript Snippet:
JavaScript Paragraph Toggle
Posted on Jun 29, 2008 5:24 am
Posted on Jun 29, 2008 5:24 am
I have tried both.
Javascript Snippet:
JavaScript Paragraph Toggle
Posted on Jun 29, 2008 5:56 am
Posted on Jun 29, 2008 5:56 am
so just like that???
how about you show me EXACTLY what you have.........
how about you show me EXACTLY what you have.........
Javascript Snippet:
JavaScript Paragraph Toggle
Posted on Jun 29, 2008 6:06 am
Posted on Jun 29, 2008 6:06 am
It\'s OK thanks, I\'m using Hawkee\'s snippet just now, but thanks for the offer!






