当 dropkick 样式的下拉列表具有多个项目时,不会调用 Ajax 回调函数



我有一个aspx页面,其中包含许多dropkick样式的下拉列表。页面中的某些下拉列表只有一个项目,而同一页面中的某些下拉列表可能包含多个项目。每个下拉列表都有一个onchange事件(javascript),它调用当用户在下拉列表中选择项时,Ajax 函数。

Ajax 函数是从 dropkick.js 文件中调用

if ($option.parents('.dk_container').siblings('select').attr('type') == "AttributeValue") {
    //for changing the details of a product when the product attribute is changed
     var selectedItemValue = ''; //the value of the current
     var dropDownName = '';
     selectedItemValue = parseInt($option.attr('data-dk-dropdown-value'));
     dropDownName = $option.parents('.dk_container').siblings('select').attr('name');
     /*javascript function that calls the Ajax function */
     ChangeProductDetails(selectedItemValue, dropDownName);
            } 

问题是当用户在包含多个项目的下拉列表中选择一个项目调用 Ajax 函数,但不调用 Ajax 回调函数。

如果下拉列表仅包含一个项目,则按预期调用 Ajax 回调函数。

提前感谢您的任何提示

问候

马修

DropKicks 看起来像这样:

     $('.change').dropkick({  
     change: function (value, label) {  
     alert('You picked: ' + label + ':' + value);  
       }  
 });

多选微件有一个如下所示的单击事件:

  $("#multiselect").bind("multiselectclick", function(event, ui){

/* 事件:原始事件对象

 ui.value: value of the checkbox
 ui.text: text of the checkbox
 ui.checked: whether or not the input was checked
 or unchecked (boolean)

*/

});

您必须以这种方式附加更改事件逻辑

我有这个给你..看看它...

已编辑

<script type="text/javascript" src="Your-JQueryDropKick_JS_file_path"></script>
 <script type="text/javascript" language="javascript">
    $(document).ready(function () {
   // Logic Code
     $('.change').dropkick({  
         change: function (value, label) {  
         alert('You picked: ' + label + ':' + value);  
         }  
      });
    });
</script>

最新更新