下拉列表中的Prestashop过滤器不起作用
16lz
2021-01-22
I have problem with filter in Prestashop. Originally in blocklayered.js exist that code:
我在Prestashop过滤器有问题。最初在blocklayered.js中存在该代码:
$(document).on('click', '#layered_form select',function(e) {
reloadContent(true);
});
However this code is wrong, because when I click on select - function reloadContent() is started. I want to start that function when user click on option in dropdown list. I changed the code:
但是这段代码是错误的,因为当我点击select - function reloadContent()时就启动了。我想在用户点击下拉列表中的选项时启动该功能。我更改了代码:
$(document).on('click', '#layered_form select option', function(e) {
reloadContent(true);
});
Now, my filter work correctly in firefox but doesn't work in chrome. What is the reason?
现在,我的过滤器在Firefox中正常工作,但在chrome中不起作用。是什么原因?
1 个解决方案
#1
You should instead just use the change
event of select
element:
您应该只使用select元素的change事件:
$(document).on('change', '#layered_form select',function(e) {
reloadContent(true);
});
更多相关文章
- arcgis api for js入门开发系列十 自定义Navigation控件样式风格
- 五十行javascript代码实现简单的双向数据绑定
- 在内容可编辑DIV中的选定文本周围包装bb代码
- 常用验证JS代码基础及实例
- 试着在我的javascript代码中理解“this”(一件事有效,另一件没有)
- 代码点火-如何从控制器返回Json响应
- 小弟初学网页(javascript),看不懂下面的代码。但又要完成任务 各位
- 使用jquery在textarea中的颜色代码
- 为什么我的javascript/jquery代码不能像预期的那样工作?