jquery Accordion prevent accordion change

Loki

I'm using the jquery Accordion to hide some data.

The accordion header is a table with some table headers. There is one header of which I don't want that if you click it the accordion event fires.

so

<div id="accordion">
    <div id="table">
    <table>
        <tr>
        <th>Test</th>
        <th></th>
        <th></th>
        <th class="nofunction">Test2</th>
        </tr>
    </table>
    </div>
    <div>
        <p>
        Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
        ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
        amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
        odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
        </p>
    </div>
</div>

The accordion is collapsible, and if you click on Test2 (class nofunction) the accordion event should not fire. But if you click on Test or other table Headers the accordion should fire the event.

Can I add this functionallity?

update http://jsfiddle.net/e3Q8d/ for testing. jquery ui is included

James Hibbard

Just add this to your JS:

$(".nofunction").on("click", function(e){
    e.stopPropagation();
});

Fiddle

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

TOP Ranking

HotTag

Archive