jQuery textbox.val('xxxx')不会引起更改? [英] jQuery textbox.val('xxxx') not causing change to fire?
本文介绍了jQuery textbox.val('xxxx')不会引起更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的页面上有以下jQuery代码:
I have the following jQuery code in place on my page:
var isChanged = false;
$(document).ready(function()
{
$('.change').change(function() {
isChanged = true;
});
});
我正在使用一个插件来修改其链接到的文本框的值,使用:
I am using a plugic that modifies the value of the text box it is linked to using:
target.val('xxxx');
html中的文本框(来自asp.net)是:
the text box in the html (from asp.net) is:
<input name="ctl00$cphHolder1$rptFlex$ctl01$txtLeftRank"
type="text"
value="52°"
id="ctl00_cphHolder1_rptFlex_ctl01_txtLeftRank"
class="change atiselector" />
使用代码更改文本框的值时,不会触发更改.如果我在文本框中键入内容,则会触发更改.我想念什么?
When the value of the text box is changed using code, the change is not firing. If I type in the text box, the change fires. What am I missing?
推荐答案
这就是它的工作方式.如果您需要更改值来触发更改"事件,则可以通过以下方式明确地做到这一点:
That's the way it works. If you need the change of value to trigger the "change" event, you can explicitly do so by:
$('input#whatever').val('hi').change();
这篇关于jQuery textbox.val('xxxx')不会引起更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文