如果我使用Jquery在下拉列表中选择相同的值,则第二次不会调用函数。 [英] Function Is Not Getting Call At Second Time If I Select The Same Value In Dropdown Using Jquery.

查看:64
本文介绍了如果我使用Jquery在下拉列表中选择相同的值,则第二次不会调用函数。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的团队,



我的代码如下。



Dear Team,

I have the Code as follows.

$('#allocateToSelect').change(function () {
           debugger;
           $("#allocateToSelect option:selected").val();
           GetQCCount();
       });







我已插入值我的DropDown.DropDown如下:




I have the Value inserted on my DropDown.DropDown as follow:

<td>
                        <select id="allocateToSelect" class="combo150">
                           </select>
                    </td>



我的问题是当我在下拉列表中选择值时。 .Change功能正在接听电话,这很好。

但是如果我第二次选择相同的值我的功能没有接到电话,为什么会这样。

请指导我。

谢谢

Harshal


My problem is when i select the value in the dropdown . .Change Function is getting call which is fine.
But if I select the same value at second time my function is not getting call ,Why is it so .
please Guide me.
Thanks
Harshal

推荐答案

' #allocateToSelect')。change(function(){
debugger;
('#allocateToSelect').change(function () { debugger;


#allocateToSelect选项:选中)。val();
GetQCCount();
} );
("#allocateToSelect option:selected").val(); GetQCCount(); });







我在DropDown.DropDown上插入了Value,如下所示:




I have the Value inserted on my DropDown.DropDown as follow:

<td>
                        <select id="allocateToSelect" class="combo150">
                           </select>
                    </td>



我的问题是当我选择落下 。 .Change功能正在接听电话,这很好。

但是如果我第二次选择相同的值我的功能没有接到电话,为什么会这样。

请指导我。

谢谢

Harshal


My problem is when i select the value in the dropdown . .Change Function is getting call which is fine.
But if I select the same value at second time my function is not getting call ,Why is it so .
please Guide me.
Thanks
Harshal


原因是因为你在第二项中选择了相同的选项,所以改变事件不会得到被解雇。如果您选择另一个值并再次选择第一个值,则会触发事件。当select子句中的项目选择发生变化时,会触发更改事件。
The reason is since you are selecting the same option the second item, change event does not gets fired. If you select another value and select the first one again, event gets fired. Change event gets fired when the selection of items in the select clause are changed.


这篇关于如果我使用Jquery在下拉列表中选择相同的值,则第二次不会调用函数。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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