开发者

JQuery Accordion with buttons - How to prevent opening?

开发者 https://www.devze.com 2023-03-24 23:30 出处:网络
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开发者_JS百科. Now I would like to be able to click the buttons withou

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开发者_JS百科. Now I would like to be able to click the buttons without opening that section.

JQuery Accordion with buttons - How to prevent opening?

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消