Toggle Link Text And Show / Hide ID Onclick
Apr 20, 2010
I am trying to create a Link that changes its currently displayed text and also toggles the css.display property from inline to hidden. I'm sure there are solution outs there btu I have not been able to find one that does both functions with one click properly and is also easy to implement for people not as familiar with html and javascript. Obviously I am trying to create a show more, show less type link. currently this often shared code works fine to change the current state of the target ID's css.display from none to inline. My end goal is to be able to not only toggle the display of the LONG1 div but to also change the innerhtml of 'short1' from "Show More" to "Show Less".I am still learning about JS so Im really rough around the edges. I tried some different techniques btu I dont ahev them posted on my work pc.
View 14 Replies
ADVERTISEMENT
Mar 3, 2009
Im trying to hide a div ( quick reply box) like IPB using this code it's hidden but the actual link to toggle it isn't a live link for some reason any idea's what im doing wrong would be good.
This is what i am trying to hide
Im not sure how i get this to toggle to show/ re hide the div.
<div id="myClickyDiv" onclick="swapMyToggledDiv();">Toggle</div>
View 3 Replies
View Related
Sep 12, 2011
I am trying to hide/show table when hide/show button is pressed
Problem: The code works fine when I remove 'slow' from line 10. But with 'slow' in line 10 content of toggleButton doesnt change from Hide to Show when pressed.
Code:
View 1 Replies
View Related
Jan 11, 2010
I can I take a code like this:
<script language="javascript">
function toggle() {
var ele = document.getElementById("toggleText");
[Code]....
But make it so you see "Show" before you click, then change the text to "Hide" once you click the link?
View 12 Replies
View Related
Jan 25, 2010
I'm using a classic toggleLayer function to display content in a div adjacent to one full of links.
The code is
function toggleLayer( work ){
var elem, vis;
if( document.getElementById ) // this is the way the standards work
elem = document.getElementById( work );
else if( document.all ) // this is the way old msie versions work
elem = document.all[work];
else if( document.layers ) // this is the way nn4 works
elem = document.layers[work];
vis = elem.style;
// if the style.display value is blank we try to figure it out here
if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
And the links take on the format of:
<a href="javascript:toggleLayer('work');...........
My problem is, I want the 'work' div to remain blank, which it does, until I click one of the links. But after that initial click, I don't want the script to act as a toggle, just a show/change content.
View 1 Replies
View Related
Dec 21, 2007
Ive been trying different show/hide methods for like, a week now. And I cannot get a single one of them to work. Even a little bit
Ive no idea what I'm doing, I'm usually not so bad at figuring stuff out, at this point im going to punch things. haha
can anyone point me to a template that uses a show/hide function. Or a pre-made page using mootools fx.slide? I cant even get the demo there to do anything.
View 2 Replies
View Related
Apr 15, 2011
My script:
Question:How can I insert a cookie to this, so that when I hide it, it will remain hidden after refreshing the page.
View 2 Replies
View Related
Jul 29, 2010
I'm trying to do a quick and dirty jQuery toggle swap, I'm swapping the div ok, but I can't seem to work out how to swap back to the original.
[Code]...
View 1 Replies
View Related
May 24, 2011
Completely new to jQuery but I am trying to implement a few pieces on my new website. At the moment I have three images in a row and I want to be able to click on any one of the images and use jQuery to populate a hidden div below the three images that contains more info and slide it out using the fold animation. I'd also like it if when a second image was clicked it closed the currently open div and opened the new one. I've seen tutorials that open the divs but can't find one that closes them again on opening a new one.
Can anyone point me to a tutorial that does this or suggest how it could be done?
View 2 Replies
View Related
Oct 24, 2010
On the homepage of my site, I would like to have some nav links that toggle between a few divs that are below in the content The divs in the content should display one at a time. For example, if you click nav1, the user would see div1. If nav2 is then clicked, div1 would hide and div2 would display.
I have some code that will do this, but for some reason it is hiding any divs that are within the toggled div. I'm very basic with JS and could use some help here. Here is my code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
function toggleID(IDS) {
var area = document.getElementById('secondContent');
var sel = area.getElementsByTagName('div');
[Code]...
View 1 Replies
View Related
Mar 2, 2007
I've a frameset in my application.
1. A header Frame. (header)
2. A Tree Frame (left)
3. A Main Frame for displaying main contents. (mainFrame)
Well, I just want to toggle the visibility of the Left Tree frmae to provide more space to the Contents page when required.
> There can be a button which will have the label as HIDE when frame is visible.
> And when frame is hidden, the buttons label should be SHOW, clicking on which should show the frame baxck in its place.
View 3 Replies
View Related
Apr 3, 2010
Im trying to toggle a block of info on a forum that gets displayed multiple times. The below works for just one ID but I'll have more then one.
Code:
function toggle() {
var ele = document.getElementById("toggleUserinfo");
var text = document.getElementById("displayUserinfo");
if(ele.style.display == "block") {
[Code]..
View 5 Replies
View Related
Dec 7, 2010
Complete JS first timer here, hope you all can understand my difficulties and stupidities without getting too frustrated. Trying to make a portfolio website as a Christmas gift. Anyway, I'm trying to build a menu that:
1. Expands/Retracts when clicking on other 'headers' in the Menu.
2. Allows for more than one object to be listed in each 'header'.
(Something similar to this [URl]... I've tried to hatch together several online solutions but I really have no idea what I'm doing, as you can see:
[Code]...
View 1 Replies
View Related
Jul 18, 2010
I have one long text field in HTML to feed text as input in my page. the entered text will be shown as output text after some operations.In this context, i need to display few text(say 200 chars) only and i need to provide READMORE link/button which would show me the complete content of that text field. I need to achieve this shortly!
View 2 Replies
View Related
Aug 10, 2011
I have spent two days trying to figure this out...No Luck.I am creating a dynamic list I would like to assign a value to a button that if the PY =Blue then show only py=blue and the same for py=Green then show only green.My Code:
<!DOCTYPE html>
<html>
<head>
[code]....
View 1 Replies
View Related
Jul 28, 2010
I have 2 divs: <div id="box1></div> and <div id="box2></div> I also have one link to contoll them both. The effect I want to get is: when I click first time on my link box2 hides, when i click second time also box1 hides, when I click third time both divs should show. I manage to do that both divs hiding but later I can't get the show. Im trying sth like this:
$(document).ready(function() {
$('.slick-hide').click(function() {
$('#box2').hide('fast');
$('.slick-hide').click(function() {
$('#box1').hide('fast');
$(".slick-hide").removeClass("slick-hide").addClass("slick-show");
$('.slick-show').click(function() {
[Code]...
View 2 Replies
View Related
Jun 30, 2011
im trying to create an array with mutiple div ids. send this off to the function and the function switches the classes to show or hide depending on state.
[Code]....
View 3 Replies
View Related
Aug 2, 2010
jQuery Code...
Clicking the link toggles the visibility of the Disclaimer, but it does not toggle the text of the a#toggleButton. How can I make this work?
View 3 Replies
View Related
Aug 27, 2010
I have the following show/hide div function made with jQuery:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
[Code].....
It toggles perfectly, but I would like to make to which appears to overlap the underlaying content div below. Right now it just pushes down the content div when sliding out.
View 2 Replies
View Related
Mar 17, 2010
Heres the code -
<html>
<head>
<title></title>
[code]....
View 7 Replies
View Related
Nov 17, 2009
I am new to javascript, and am having an issue, which I'm sure is elementary.. I found a script for expandable content, it suffices fine. As it stands, the script toggles images onclick. For example, whence the menu is collapsed, it displays "plus.gif" next to it, and when the menu is expanded, it displays "minus.gif" next to it.
Basically, what I would like to know is, thus: how would I change it to display text icons next to it? For example, in place of "plus.gif" I should like it to display "+" as actual text. I've dredged a number of places, however, I've found nothing. Furthermore, I cannot figure out how to do it.
View 1 Replies
View Related
Jul 6, 2009
I want to use a toggle to hide and show some content but it isnt working
html code:
JS code:
But this code dont works correct, notiv that i want to use more then one box.
View 5 Replies
View Related
Aug 16, 2011
I'm using mootools-core-1.3.2.js & mootools-more-1.3.2.js to toggle hide/show a div
but since I started using jquery-1.4.4.js the mootools toggle stopped working. Here is the jquery code I'm using on all of my pages
Code:
$().ready(function() {
function formatItem(row) {
return row[0] + " (" + row[1] + ")";
}function formatResult(row) {
return row[0].replace(/(<.+?>)/gi, '');
} .....
View 11 Replies
View Related
May 6, 2010
Does anyone know why this isn't working? The toggle function works perfectly fine with PHP loops, but when I insert the table td tr tags, it does not hide the loop when the page first loads...It just shows the results in the div which it shouldn't be doing.
Here's what my code looks like...
JS
Code:
<script type="text/javascript">
function toggle(element) {
if (document.getElementById(element).style.display == "none") {
[Code]....
View 3 Replies
View Related
Jan 6, 2011
I have a paragraph that I have set to disappear on the click of the Hide button, I have also set the button to toggle between Hide and Show depending on whether or not the content is visible. My problem is, when I add 'slow' as the duration the button doesnt seem to toggle between hide and show?
Code:
<p id="disclaimer">
Disclaimer! This service is not intended for the those with criminal intent. Celebrities are kind of like people so their privacy should be respected.
</p>
Code JavaScript:
$(document).ready(function() {
$('<input type="button" class="toggle" name="toggle" value="Hide" />').insertAfter('#disclaimer');[code].....
View 4 Replies
View Related
Oct 20, 2006
I am using prototype to add a "blind" up and down functionality when I click on a table element.
Now, i would like to toggle the [-] in the "altlink" span to match the state. Ie, if a person clicks on the table, the "formhide1" span will collapse, and the [-] should turn into a [+]. Visa versa, when the now collapsed "formhid1" span is expanded the [+] should turn into a [-] Code:
View 8 Replies
View Related