Kees C. Bakker
Kees C. Bakker

Reputation: 33391

JQuery Accordion with buttons - How to prevent opening?

I've been playing around with the Accordion in the JQuery UI library. I've created some headers and I added some buttons to them. Now I would like to be able to click the buttons without opening that section.

Accordion

My buttons are in fact ASP.Net buttons that generate scripts with onclick="some scripting". This scripts still needs to be executed. Any ideas?

Upvotes: 1

Views: 2101

Answers (1)

Semyazas
Semyazas

Reputation: 2101

If they're nested you could catch this click event before it's bubbling up to parent elements by using

$('#buttonid').click(function(e){
    e.stopPropagation();
    //Your Code here(For example a call to your function)
});

You shouldn't use onClick in the markup, if you're working with a JS Framework anyways

Upvotes: 3

Related Questions