【问题标题】:handling OK click with multiple sumo select instaces使用多个相扑选择实例处理 ONclick
【发布时间】:2017-04-22 16:01:40
【问题描述】:

如果我在同一页面中使用相扑选择和 2 个列表框,我如何识别单击“确定”按钮的列表实例。

以下是我的完整代码: 以下是我的完整代码:

<script 
  src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js">
</script>
<script src="jquery.sumoselect.min.js"></script>
<link href="sumoselect.css" rel="stylesheet" />

<script type="text/javascript">
$(document).ready(function () {
$(<%=ListBox1.ClientID%>).SumoSelect({ selectAll: true, okCancelInMulti: 
true });
$(<%=ListBox2.ClientID%>).SumoSelect({ selectAll: true, okCancelInMulti: 
true });

$('.btnOk').on('click', function ()
{
  alert('OK button Clicked');    });
});
</script>    

<body>
<form id="form1" runat="server">
<div>

</div>

<asp:ListBox runat="server" ID="lstBoxTest1" SelectionMode="Multiple">
 <asp:ListItem Text="Red" Value="0"></asp:ListItem>
 <asp:ListItem Text="Green" Value="1"></asp:ListItem>
 <asp:ListItem Text="Yellow" Value="2"></asp:ListItem>
 <asp:ListItem Text="Blue" Value="3"></asp:ListItem>
 <asp:ListItem Text="Black" Value="4"></asp:ListItem>
 </asp:ListBox>

<asp:ListBox runat="server" ID="lstBoxTest2" SelectionMode="Multiple">
<asp:ListItem Text="Merc" Value="0"></asp:ListItem>
<asp:ListItem Text="Audi" Value="1"></asp:ListItem>
<asp:ListItem Text="Jaguar" Value="2"></asp:ListItem>
<asp:ListItem Text="Porsche" Value="3"></asp:ListItem>
<asp:ListItem Text="Toyota " Value="4"></asp:ListItem>
</asp:ListBox>

</form>
</body>

【问题讨论】:

标签: jquery


【解决方案1】:

如果 triggerChangeCombined:true 和 选择已更改。


$(<%=lstBoxTest2.ClientID%>).SumoSelect({ selectAll: true, okCancelInMulti:true,triggerChangeCombined:true }); $(<%=lstBoxTest2.ClientID%>).on('change',function(e){ alert('OK button Clicked'); });


【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-30
    • 1970-01-01
    • 2012-02-23
    • 1970-01-01
    • 2014-01-20
    相关资源
    最近更新 更多