如何重新加载jQuery dropkick对象 [英] How to reload jquery dropkick object

查看:93
本文介绍了如何重新加载jQuery dropkick对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用一个简单的选择列表和jquery.dropkick库使它漂亮. 现在,我想在相应的select元素已更改(一个新选项进入)之后更改该dropkick内容.但是只是调用$('#select').dropkick();不起作用.

Im using a simple select list and the jquery.dropkick library to make it beautiful. Now i want to change that dropkick content after the corresponding select element has been changed (a new option came in). But just calling $('#select').dropkick(); doesnt work.

它似乎不受支持. 仅从头开始重建该dropkick就足够了.是否有可能破坏"该dropkick对象,然后通过调用.dropkick()方法来重建它?

And it looks like it is not supported. It would be enough just to rebuild that dropkick from scratch. Is there any possibility to "destroy" that dropkick object then rebuilding it by calling the .dropkick() method?

推荐答案

我也遇到了同样的问题,找不到解决方案,但最终成功地完成了该黑客工作.

I have faced the same issue and couldn't find a solution, but finally succeeded in getting this hack work.

$select = $("#select1");
$select.removeData("dropkick");
$("#dk_container_select1").remove();

$select.append("<option>opt4</option>");
$select.append("<option>opt5</option>");

$select.dropkick();

这篇关于如何重新加载jQuery dropkick对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆