简体   繁体   English

jQuery UI手风琴内部的链接

[英]Link inside jQuery UI Accordion

Using jQuery UI Accordion to create dropdowns for a filter list. 使用jQuery UI Accordion为过滤器列表创建下拉列表。

http://89.151.89.43/uk/trade-essentials-column-radiators-1.html#usestorage http://89.151.89.43/uk/trade-essentials-column-radiators-1.html#usestorage

Inside the Header there is also a clear button (You need to select an option for it to appear) The CMS is generating this automatically, unfortunately it doesn't function because it's inside the H4 tag surrounding it. 标头内还有一个清除按钮(您需要选择一个选项才能显示它)CMS正在自动生成此消息,不幸的是,它不起作用,因为它位于其周围的H4标签内。

You will see an onclick function on the clear-button, I would like to keep the button where it is but just allow it to function. 您会在清除按钮上看到一个onclick函数,我想将按钮保留在原处,但只允许它起作用。

To recreate: 重新创建:

  1. Go to the above link 转到上面的链接
  2. Select an option on the left 在左侧选择一个选项
  3. Clear button should appear 清除按钮应出现
  4. Try click the 'Clear' button 尝试点击“清除”按钮
  5. The accordion should then close 然后手风琴应关闭

What I want: The function contained in the 'onclick' to clear all checkboxes that are under that header 我想要的是:'onclick'中包含的功能,用于清除该标题下的所有复选框

Without seeing the source code, I can't give you an exact answer, but in general you want to do something like this: 在没有看到源代码的情况下,我无法给您确切的答案,但总的来说,您想要执行以下操作:

$("#clear-button").click(function(event){
    event.stopPropagation();
    event.preventDefault();
    log("clicked!");
});

Looking at your example page, there seems to be a lot code missing. 查看示例页面,似乎缺少很多代码。

I would suggest something like: 我建议类似的东西:

$(".clear-button").on("click", function(event) {
  event.preventDefault();
  $(this).parent().parent().find(":checked").prop("checked", false);
});

When the button is clicked, after being generated dynamically, you will want to find the input elements that are within the parent div element. 单击按钮后,将在动态生成按钮之后,查找位于父div元素内的input元素。 Since the button is within the h4 , you have to find that parent div . 由于按钮位于h4 ,因此必须找到该父div

An example, not working, since I cannot find the OnFilter() function code. 一个例子,不起作用,因为我找不到OnFilter()函数代码。 You could assign the click callback when the button is added instead of using the .on() . 您可以在添加按钮时分配click回调,而不是使用.on()

https://jsfiddle.net/Twisty/o4L504ya/ https://jsfiddle.net/Twisty/o4L504ya/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM