[英]Detect Label Change Using - jQuery
I have a lookup field so based on the drop down change the lookup field value changes 我有一个查找字段,因此根据下拉更改查找字段的值更改
var name; $("#tdf_15").on('DOMSubtreeModified', function () { name = $(this).html(); alert(name); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="tdf_15" class="cell dc" style="background-color: rgb(255, 253, 221);">Dileep Thomas</div>
So this snippet will alert whenever the lookup field changes , but the alert is working for three times initially when the field is blank and once it is have a value then alert will work for four times at each time we change the drop down. 因此,此代码段将在查找字段发生更改时发出警报,但当该字段为空且具有一个值时,该警报最初会运行3次,而每次更改下拉列表时,警报都会运行4次。 I need to have the alert for only one time also i need to check the value in the variable( name ) is changed or not. 我只需要警报一次,也需要检查变量( name )中的值是否更改。
Many thanks in advance if anyone can help me !! 提前非常感谢,如果有人可以帮助我!
Change DOMSubtreeModified
to change
更改DOMSubtreeModified
进行change
var name;
$("#tdf_15").on('change', function () {
name = $(this).html();
alert(name);
});
I think i got the solution i searched the developers google Stackoverflow itself 我认为我找到了解决方案,我在开发人员中搜索了Google Stackoverflow
The below link 4th answer solved this isssue 下面的链接第四个答案解决了这个问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.