jquery show/hide
Posted: 11 October 2008 12:05 AM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2323
Joined  05-13-2004

I’m trying to do something with jquery but it just isn’t working. I’ve got a list of entry titles that want to be hidden until the user clicks on the h2 tag above it.

Here is the code and the page where it should be working (bottom right)

<h2 class="toggle">All Teachers</h2>
    <
div class="view">
    
{exp:weblog:entries weblog="teachers" orderby="date" sort="desc" limit="100" status="open" dynamic="off" disable="member_data|pagination|trackbacks"}
    {categories}
<h3><a href="{permalink=">{title}</a></h3>{/categories}
    {
/exp:weblog:entries}
    
</div>

<
scr*pt type="text/javascript">
    $(
document).ready(funtion(){
        
$('div.view').hide();
        $(
'h2.toggle').click(function(){
            
$('div.view').show();
            $(
this).hide();
        
});
    
});
</
scr*pt>
 Signature 

CreateSean Web Design | EE Forums 4 You ExpressionEngine forum customization
on twitter @CS_sean I am the poster formally known as The Linguist.

Profile
 
 
Posted: 11 October 2008 02:54 AM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1130
Joined  02-15-2008

On a scale of 1 to 10, where 10 is “REALLY annoying”, how annoying would it be if the problem was down to that typo on ‘function’?

<scr*pt type="text/javascript">
    $(
document).ready(funtion(){

LOL

 Signature 

Andy Harris | Pepper Digital | Malvern, UK | Twitter | New to ExpressionEngine? Start here!

Profile
 
 
Posted: 11 October 2008 02:59 AM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2323
Joined  05-13-2004
Andy Harris - 11 October 2008 02:54 AM

On a scale of 1 to 10, where 10 is “REALLY annoying”, how annoying would it be if the problem was down to that typo on ‘function’?

<scr*pt type="text/javascript">
    $(
document).ready(funtion(){

LOL

fixed that red face  but problem still not solved.

 Signature 

CreateSean Web Design | EE Forums 4 You ExpressionEngine forum customization
on twitter @CS_sean I am the poster formally known as The Linguist.

Profile
 
 
Posted: 11 October 2008 03:01 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1130
Joined  02-15-2008

Ahha, you’re targetting a.toggle, but the toggle appears to be on an h2. Change:

$(a.toggle').click(function(){

to

$(h2.toggle').click(function(){

And you should be cracking!

 Signature 

Andy Harris | Pepper Digital | Malvern, UK | Twitter | New to ExpressionEngine? Start here!

Profile
 
 
Posted: 11 October 2008 03:05 AM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2323
Joined  05-13-2004

delete - I’m dumb.

 Signature 

CreateSean Web Design | EE Forums 4 You ExpressionEngine forum customization
on twitter @CS_sean I am the poster formally known as The Linguist.

Profile
 
 
Posted: 11 October 2008 04:04 AM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1130
Joined  02-15-2008

Nah, not at all. I get caught out on stuff like this all the time - best thing to do is stop looking at it and go for a 5 min walk or something! I always say that the seemingly most obvious problems are the hardest to spot.

 Signature 

Andy Harris | Pepper Digital | Malvern, UK | Twitter | New to ExpressionEngine? Start here!

Profile
 
 
Posted: 18 October 2008 04:18 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  301
Joined  04-12-2008

Hi Sean

Is it working yet? If not, here’s the a quick try at it, this should work as supposed:

[removed]
    
$(document).ready(function(){
        
$('div.view').hide();
        $(
'h2.toggle').click(function(){
            
$(this).next().toggle();
        
});
    
});
[removed]
 Signature 

Designchuchi | Twitter

URL Field Extension
Required Category Extension
DC FreeForm GeoIP Extension
DC Template Manager

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120594 Total Logged-in Users: 74
Total Topics: 126631 Total Anonymous Users: 43
Total Replies: 665677 Total Guests: 402
Total Posts: 792308    
Members ( View Memberlist )