Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery twitter引导模式表单内未触发keyup事件_Jquery_Twitter Bootstrap - Fatal编程技术网

Jquery twitter引导模式表单内未触发keyup事件

Jquery twitter引导模式表单内未触发keyup事件,jquery,twitter-bootstrap,Jquery,Twitter Bootstrap,我正在使用Twitter引导 我已经创建了一个模态窗口,并按预期调用它 在该模式中,有一种形式: <div id="initialSurveyInfo" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="modalId" aria-hidden="true"> <div class="modal-header"> <button type="button"

我正在使用Twitter引导

我已经创建了一个模态窗口,并按预期调用它

在该模式中,有一种形式:

<div id="initialSurveyInfo" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="modalId" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="modalId">Initial Survey Information</h3>
    </div>
    <div class="modal-body">
        <form class="form-horizontal">
            <div class="control-group">
                <label class="control-label" for="surveyTitle">Survey Title :</label>
                <div class="controls">
                    <input type="text" id="surveyTitle">
                    <span class="help-inline muted"><span class="char-limit">36</span> character(s) left</span>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="surveyDesc">Description:</label>
                <div class="controls">
                    <textarea rows="5"></textarea>
                </div>
            </div>
        </form>
    </div>
    <div class="modal-footer">
        <a href="#" class="btn" data-dismiss="modal" aria-hidden="true">Cancel</a>
        <a href="/createSurvey" class="btn btn-primary continue">Continue</a>
    </div>
</div>
不幸的是,没有触发keyup和change事件/方法。因此,剩余字符计数不会下降,并且当超过字符计数时,继续按钮也不会被禁用。 我用on'keyup'函数替换了keyup,这也不起作用

你知道我如何应对按键事件吗?主要的问题是在这种情况下如何改变剩下的字符数

我也在使用AngularJS,但我不认为它会影响AngularJS基于之前的动作加载的视图模板中的模式窗口

on('keyup','#surveyTitle', function) {

}


$("body").on('keyup', "#surveyTitle", calculate);  
你试过这样吗


你试过这样吗

终于找到了解决办法@sasi的解决方案部分是正确的

基本上,这里讨论的是这个问题:

解决方案如下: 替换

$("#surveyTitle").keyup(calculate);  

$("body").on('keyup', "#surveyTitle", calculate);  

终于找到了解决办法@sasi的解决方案部分是正确的

基本上,这里讨论的是这个问题:

解决方案如下: 替换

$("#surveyTitle").keyup(calculate);  

$("body").on('keyup', "#surveyTitle", calculate);  

几乎正确。我需要将$'body'选择器添加到on方法中。请看下面我的答案。它起作用了。我跟进了你的线索,发现github的问题也提到了正确的方法。几乎正确。我需要将$'body'选择器添加到on方法中。请看下面我的答案。它起作用了。我跟进了你的线索,发现github的问题也提到了正确的方法。