Jquery 选中复选框并启用该复选框时是否要启用按钮

Jquery 选中复选框并启用该复选框时是否要启用按钮,jquery,html,button,checkbox,scroll,Jquery,Html,Button,Checkbox,Scroll,我只想在选中复选框和启用时启用按钮,但它不起作用,这也取决于上面的文本区域滚动。选中复选框后需要上下滚动以启用按钮。 这是我的html: <textarea rows="20"> The Fédération Internationale de Football Association (FIFA, /ˈfiːfə/; English: Federation of International Football Associations) is the international

我只想在选中复选框
启用时启用按钮,但它不起作用,这也取决于上面的
文本区域
滚动。选中
复选框后
需要上下滚动以启用按钮。
这是我的html:

<textarea rows="20">
  The Fédération Internationale de Football Association (FIFA, /ˈfiːfə/; English: Federation of International Football Associations) is the international governing body of association football, futsal and beach soccer. Its membership comprises 209 national associations. Its headquarters are in Zurich, Switzerland, and its president is Sepp Blatter. FIFA is responsible for the organisation of football's major international tournaments, notably the World Cup. The need for a single body to oversee association football became apparent at the beginning of the 20th century with the increasing popularity of international fixtures. FIFA was founded in Paris on 21 May 1904; the French name and acronym persist even outside French-speaking countries. The founding members were the national associations of Belgium, Denmark, France, the Netherlands, Spain (represented by Madrid Football Club; the Spanish federation was not created until 1913), Sweden and Switzerland. Also, that same day, the German Association declared its intention of affiliating through a telegram.
</textarea>
<div>
  <input type="checkbox" disabled="disabled" value="I agree all." id="agre"/>I agree all.
</div>
<div>
  <input type="submit" disabled="disabled" value="Submit" />
</div>

您正在滚动事件处理程序中定义change()处理程序。尝试在
document.ready()中取出它。
您正在滚动事件处理程序中定义change()处理程序。尝试在
document.ready()中取出它。
您正在滚动事件处理程序中定义change()处理程序。尝试在
document.ready()中取出它。
您正在滚动事件处理程序中定义change()处理程序。首先尝试在
document.ready()中取出它(您不需要
,因为用户在阅读完毕后可能会向上滚动):

然后,如果textarea滚动监听器在外部:

$('#agre').change(function() {
  $(':submit').attr('disabled', !$('#agre').is(':checked'));
});
这也要短得多,并且做同样的事情。

首先(您不需要
或者
,因为用户在完成阅读时可能会回滚):

然后,如果textarea滚动监听器在外部:

$('#agre').change(function() {
  $(':submit').attr('disabled', !$('#agre').is(':checked'));
});
这也要短得多,并且做同样的事情。

首先(您不需要
或者
,因为用户在完成阅读时可能会回滚):

然后,如果textarea滚动监听器在外部:

$('#agre').change(function() {
  $(':submit').attr('disabled', !$('#agre').is(':checked'));
});
这也要短得多,并且做同样的事情。

首先(您不需要
或者
,因为用户在完成阅读时可能会回滚):

然后,如果textarea滚动监听器在外部:

$('#agre').change(function() {
  $(':submit').attr('disabled', !$('#agre').is(':checked'));
});
这也要短得多,并且做同样的事情。

使用这个

HTML

   <textarea rows="20" id="txtarea">The Fédération Internationale de Football Association (FIFA, /ˈfiːfə/; English: Federation of International Football Associations) is the international governing body of association football, futsal and beach soccer. Its membership comprises 209 national associations. Its headquarters are in Zurich, Switzerland, and its president is Sepp Blatter. FIFA is responsible for the organisation of football's major international tournaments, notably the World Cup. The need for a single body to oversee association football became apparent at the beginning of the 20th century with the increasing popularity of international fixtures. FIFA was founded in Paris on 21 May 1904; the French name and acronym persist even outside French-speaking countries. The founding members were the national associations of Belgium, Denmark, France, the Netherlands, Spain (represented by Madrid Football Club; the Spanish federation was not created until 1913), Sweden and Switzerland. Also, that same day, the German Association declared its intention of affiliating through a telegram.</textarea>
<div><input type="checkbox"  value="I agree all." id="agre"/>I agree all.</div>
<div><input type="submit" id="txt"  value="Submit" /></div>

使用此

HTML

   <textarea rows="20" id="txtarea">The Fédération Internationale de Football Association (FIFA, /ˈfiːfə/; English: Federation of International Football Associations) is the international governing body of association football, futsal and beach soccer. Its membership comprises 209 national associations. Its headquarters are in Zurich, Switzerland, and its president is Sepp Blatter. FIFA is responsible for the organisation of football's major international tournaments, notably the World Cup. The need for a single body to oversee association football became apparent at the beginning of the 20th century with the increasing popularity of international fixtures. FIFA was founded in Paris on 21 May 1904; the French name and acronym persist even outside French-speaking countries. The founding members were the national associations of Belgium, Denmark, France, the Netherlands, Spain (represented by Madrid Football Club; the Spanish federation was not created until 1913), Sweden and Switzerland. Also, that same day, the German Association declared its intention of affiliating through a telegram.</textarea>
<div><input type="checkbox"  value="I agree all." id="agre"/>I agree all.</div>
<div><input type="submit" id="txt"  value="Submit" /></div>

使用此

HTML

   <textarea rows="20" id="txtarea">The Fédération Internationale de Football Association (FIFA, /ˈfiːfə/; English: Federation of International Football Associations) is the international governing body of association football, futsal and beach soccer. Its membership comprises 209 national associations. Its headquarters are in Zurich, Switzerland, and its president is Sepp Blatter. FIFA is responsible for the organisation of football's major international tournaments, notably the World Cup. The need for a single body to oversee association football became apparent at the beginning of the 20th century with the increasing popularity of international fixtures. FIFA was founded in Paris on 21 May 1904; the French name and acronym persist even outside French-speaking countries. The founding members were the national associations of Belgium, Denmark, France, the Netherlands, Spain (represented by Madrid Football Club; the Spanish federation was not created until 1913), Sweden and Switzerland. Also, that same day, the German Association declared its intention of affiliating through a telegram.</textarea>
<div><input type="checkbox"  value="I agree all." id="agre"/>I agree all.</div>
<div><input type="submit" id="txt"  value="Submit" /></div>

使用此

HTML

   <textarea rows="20" id="txtarea">The Fédération Internationale de Football Association (FIFA, /ˈfiːfə/; English: Federation of International Football Associations) is the international governing body of association football, futsal and beach soccer. Its membership comprises 209 national associations. Its headquarters are in Zurich, Switzerland, and its president is Sepp Blatter. FIFA is responsible for the organisation of football's major international tournaments, notably the World Cup. The need for a single body to oversee association football became apparent at the beginning of the 20th century with the increasing popularity of international fixtures. FIFA was founded in Paris on 21 May 1904; the French name and acronym persist even outside French-speaking countries. The founding members were the national associations of Belgium, Denmark, France, the Netherlands, Spain (represented by Madrid Football Club; the Spanish federation was not created until 1913), Sweden and Switzerland. Also, that same day, the German Association declared its intention of affiliating through a telegram.</textarea>
<div><input type="checkbox"  value="I agree all." id="agre"/>I agree all.</div>
<div><input type="submit" id="txt"  value="Submit" /></div>


请不要对
禁用的
属性使用
attr
removeAddr
。改用
.prop('disabled',true\u或false)
。同样的情况也适用于你已经做了正确事情的
checked
区域。使用
if(scrol>373)
而不是
if(scrol='373')
我已经用prop更改了remvAttr,但是if(scrol>373)不起作用。而且我对scroll没有任何问题,它工作正常。。。我想在启用复选框并选中复选框时启用“提交”按钮。解决此问题谢谢罗杰…请不要对
已禁用的属性使用
attr
removeAddr
。改用
.prop('disabled',true\u或false)
。同样的情况也适用于你已经做了正确事情的
checked
区域。使用
if(scrol>373)
而不是
if(scrol='373')
我已经用prop更改了remvAttr,但是if(scrol>373)不起作用。而且我对scroll没有任何问题,它工作正常。。。我想在启用复选框并选中复选框时启用“提交”按钮。解决此问题谢谢罗杰…请不要对
已禁用的属性使用
attr
removeAddr
。改用
.prop('disabled',true\u或false)
。同样的情况也适用于你已经做了正确事情的
checked
区域。使用
if(scrol>373)
而不是
if(scrol='373')
我已经用prop更改了remvAttr,但是if(scrol>373)不起作用。而且我对scroll没有任何问题,它工作正常。。。我想在启用复选框并选中复选框时启用“提交”按钮。解决此问题谢谢罗杰…请不要对
已禁用的属性使用
attr
removeAddr
。改用
.prop('disabled',true\u或false)
。同样的情况也适用于你已经做了正确事情的
checked
区域。使用
if(scrol>373)
而不是
if(scrol='373')
我已经用prop更改了remvAttr,但是if(scrol>373)不起作用。而且我对scroll没有任何问题,它工作正常。。。我想在启用复选框并选中复选框时启用“提交”按钮。解决此问题谢谢罗杰…我已尝试过,但通过这样做,“提交”按钮仍处于禁用状态$(document).ready(function(){$(“textarea”).scroll(function(){var scrol=$(“textarea”).scrollTop();if(scrol='373'){$(“#agre”).removeAttr('disabled');}else{$(“#agre”).attr('disabled','disabled');});var stat$(“:checkbox”).change(function(){stat stat stat stat=$(this.prop checks('checked'));var disabl=$)(“:checkbox”).prop('disabled');if(stat==true&&disabl!=true){$(“:submit”).removeAttr('disabled');}否则{$(“:submit”).attr('disabled','disabled');});我还尝试过从文档中删除更改功能。准备就绪但仍然提交按钮仍处于禁用状态。更改功能工作正常,我已使用alert将其禁用,但按钮仍处于禁用状态。请让所有人知道您是如何做到的。如果提供的任何答案有效,请将其标记为答案。我已尝试过,但通过这样做,提交按钮仍处于禁用状态$(document).ready(function(){$(“textarea”).scroll(function(){var scrol=$(“textarea”).scrollTop();if(scrol='373'){$(“#agre”).removeAttr('disabled');}else{$(“#agre”).attr('disabled','disabled');});var stat$(“:checkbox”).change(function(){stat stat stat stat=$(this.prop checks('checked'));var disabl=$)(“:checkbox”).prop('disabled');if(stat==true&&disabl!=true){$(“:submit”).removeAttr('disabled');}否则{$(“:submit”).attr('disabled','disabled');});我还尝试过从文档中删除更改功能。准备就绪,但“提交”按钮仍处于禁用状态。更改功能正在运行