Sanjay Rathod
Sanjay Rathod

Reputation: 1143

How to apply toggle?

here is my code of html on which i have to apply togle

 <div class="contact-links contact-info">
                <ul>
                        <li class="contact-link-list toggle-sub"><a data-toggle-handler="contact-details-2" href="#">Agent Details</a>
                            <ul data-toggle-group="contact-details-2" class="senf hidden">
                                <ul style="float:left">
                                    <li style="margin-right:20px;">Office hours</li>
                                    <li style="margin-right:20px;">Products offered</li>
                                    <li>Languages</li>
                                    <li>Visit Agent Site</a></li>
                                </ul>
                                <ul style='float:left; margin-left:-20px;'>
                                    <li>Mon-Fri 9:00AM-5:00PM</li>
                                    <li>Auto, Home</li>
                                    <li>English, Spanish</li></ul>

                        </ul></li>
                </ul>
            </div>  

and here is my code of jquery

$(document).ready(function(){
    $(".contact-link-list").click(function(){
        ('.senf').slideToggle("fast");
    });
});

here is my jsfiddle - http://jsfiddle.net/n7U6b/ please suggest me where i am wrong

Upvotes: 0

Views: 66

Answers (2)

Goose
Goose

Reputation: 3279

There is no element in your example with a class of senf. Also you are missing a $ before your selector:

$('.senf').slideToggle("fast");

Edit

Here is an updated fiddle from your example. You are still missing the $, and you have a stray closing </a> tag in there, but you also need to add a class of senf to the item you want to toggle. For example:

<ul data-toggle-group="contact-details-2" class="hidden senf">

Upvotes: 3

GrahamTheDev
GrahamTheDev

Reputation: 24835

$(document).ready(function(){
    $(".contact-link-list").click(function(){
        $('.senf').slideToggle("fast");
    });
 });

You just missed a $ sign on '.senf'

Plus where is the item with class senf?? I might have missed it!

Upvotes: 1

Related Questions