使用jQuery插件DropKick下拉列表访问onchange(Accessing onchange using the jQuery plugin DropKick dropdown list)

编程入门 行业动态 更新时间:2024-10-28 04:23:48
使用jQuery插件DropKick下拉列表访问onchange(Accessing onchange using the jQuery plugin DropKick dropdown list)

在我的页面上,我有一个包含三个<select>下拉列表的表单。 所有这些列表都使用DropKick使它们看起来不错。

随着DropKick的添加,DDL不再是传统列表,因此无法访问。

根据我的发现,你只能通过在<form>标签上设置一个类然后使用以下脚本来调用onchange:

function submitIt(){ alert('test'); } $('.deviceChosen').dropkick({ change: submitIt });

这有效,并提醒节目。 但是由于几个重要原因也行不通。

第一个<select>字段是唯一显示为结果的字段。 在该元素之后的网页上的所有其他内容都将从页面中删除。

所以我有三个DDL,我希望能够设置一个在deviceChosen id DDL被更改时调用的函数。 我不希望其他两个列表的onchange事件。

这是可行的吗?

我尝试过类似下面的内容,但它不起作用。

$('#deviceChosen').on('change', function() { alert('dsf'); });

On my page, I have a form with three <select> drop down lists. All these lists use DropKick to make them look nice.

With DropKick added, the DDLs are no longer conventional lists and so cannot be accessed as such.

From what I've found, you can only call onchange by setting a class on the <form> tag and then using the following script:

function submitIt(){ alert('test'); } $('.deviceChosen').dropkick({ change: submitIt });

This works, and alert shows. But also doesn't work for a couple of big reasons.

The first <select> field is the only field that gets shown as a result. And everything else on the web page after that element gets removed from the page.

So what I have is three DDLs and I want to be able to set up a function that gets called when the deviceChosen id DDL gets changed. I don't want an onchange event for the other two lists.

Is this something that is doable?

I've tried things like the below, but it just will not work.

$('#deviceChosen').on('change', function() { alert('dsf'); });

最满意答案

我无法让这个工作,所以我最终使用了selectBox

http://labs.abeautifulsite.net/jquery-selectBox/

I couldn't get this working, so I ended up using selectBox instead

http://labs.abeautifulsite.net/jquery-selectBox/

更多推荐

本文发布于:2023-08-03 04:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1383198.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插件   列表   DropKick   jQuery   onchange

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!