Javascript .bind()在firefox中不工作
我有以下简单的javascript代码,我写了滚动的条款和条件文本区和滚动后,在条款和条件文本区的末尾,它应该启用接受复选框,它在铬工作,但不是在ff和ie请帮助 javascript代码:Javascript .bind()在firefox中不工作,javascript,jquery,scroll,Javascript,Jquery,Scroll,我有以下简单的javascript代码,我写了滚动的条款和条件文本区和滚动后,在条款和条件文本区的末尾,它应该启用接受复选框,它在铬工作,但不是在ff和ie请帮助 javascript代码: $('#blogger_agreement').bind('scroll', function() { alert('hiii'); if($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeigh
$('#blogger_agreement').bind('scroll', function()
{ alert('hiii');
if($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight)
{
$('#TermsOfService').removeAttr('disabled');
}
});
html:
<div class="control-group">
<label class="control-label"><br/>
</label>
<div class="controls">
<textarea name="blogger_agreement" id="blogger_agreement" class="deadline_date" rows="15" cols="15" style="resize: none;background-color:white; overflow-y: scroll; height: 350px;" disabled >
<?php
$file_handle = fopen(FOLDER_PATH_HTTP."terms_and_conditions.html", "r");
while (!feof($file_handle))
{
echo fgetss($file_handle);
}
fclose($file_handle);
?>
</textarea>
</div>
</div>
<div class="control-group">
<label class="control-label">
<input id="TermsOfService" type="checkbox" name="TermsOfService" required="required" disabled="true" />
</label>
<div class="controls">
<div style="width:90%;float:left;margin-top:5px;">I Accept the Terms and Conditions of The Motherhood.</div>
</div>
</div>
我接受做母亲的条款和条件。
上的jQuery 1.7中的是附加事件处理程序的首选方法:
$('#blogger_agreement').on('scroll', function()
即便如此,它也应该起作用。请参阅此,它在Chrome33和Firefox28中工作-调用alert
然后查看与您的类似但更改文本的。两者都在Chrome和Firefox中工作(至少对我来说是这样)
你使用的是什么版本的jQuery、Chrome和Firefox?使用$(this).eq(0)而不是$(this)[0]@c-link应用不起作用它不能在ff和ieTry中警告“hiii”('code>$)('blogger_agreement').bind('scroll',function(){if($(this).scrollTop()+$(this).innerHeight()>=this.scrollHeight){$('TermsOfService').prop('disabled',false);});
@arun:applicated不起作用,请查看我的更新问题抱歉问错了,请查看我的更新问题question@sameerpatil-是复选框未启用还是警报未显示?问题是:警报未显示,无法继续。我尝试了.on、.trigger、.delegate、.live……但似乎没有任何效果请帮助…(如果有拼写错误,请道歉…@sameerpatil-我的第二把小提琴在Firefox中对您有用吗-您看到对accepted的更改了吗?如果看到,则说明您的设置一定有所不同。请尝试使用console.log()而不是alert()如果警报导致中断。是否尝试在浏览器中设置断点以查看是否调用了事件处理程序?