TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 08-17-2009, 01:52 PM   #1 (permalink)
The Acquainted
 
Hightower's Avatar
 
Join Date: May 2009
Location: Durham, UK
Posts: 134
Thanks: 9
Hightower is on a distinguished road
Default jQuery - Hide Element

I have the following HTML elements in my page - about 3 to 5 of them depending on each page.

html4strict Code:
<!-- Provides the image for the top of the box -->
<div class="boxtop"></div>

<!-- Provides the rest of the box -->
<div class="box">
    <h1>Test</h1>

    <!-- Provides the place to put content/this can be hidden using jQuery-->
    <div class="boxcontent">
        <p>This is some test content</p>
    </div>
</div>

What I want to a achieve is when the boxtop element is clicked, the boxcontent element is hidden/unhidden.

This is the code I have so far for jQuery: As you can see, the boxtop background image is changed, and this works nicely (goes to a plus/minus depending on toggle status.

javascript Code:
$(document).ready(function() {   
    $(".boxtop").toggle(
        function () {
            $(this).css("background-image","url(images/boxtop_open.gif)");
        }, function() {
            $(this).css("background-image","url(images/boxtop_close.gif)");
        });
    });

What code might I use within the toggle function that would hide the boxcontent element upon click of the boxtop element?

I've looked through documentation and can't find what it is I need. I would list what I've tried but it really is too extensive (I can't even remember them all!), so I thought I'd ask the experts who could probably help me in 30 seconds flat.

Thanks!
__________________
Hightower's Softpolio
Send a message via MSN to Hightower
Hightower is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Basics or jQuery? devnull Javascript, AJAX, E4X 20 08-12-2009 03:12 PM
Help with jQuery Hightower Javascript, AJAX, E4X 8 06-23-2009 08:16 PM
jQuery Timer Plugin ETbyrne The Lounge 0 06-14-2009 02:16 PM
jquery wont work for me :( sarmenhb Javascript, AJAX, E4X 2 09-27-2008 08:52 PM


All times are GMT. The time now is 11:22 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design