它的作用是当输入输入时改变css并启用按钮,但是如果输入被删除则它不会返回到前一阶段,即禁用和不透明度0.6 ...... ..
<script>
$(document).ready(function(){
$('.gbutton').attr('disabled',true);
$('.gbutton').css( "opacity" ,"0.6" );
$('#textid').keyup(function(){
if($(this).val.length !=0){
$('.gbutton').attr('disabled', false);
$('.gbutton').css("opacity","1");
}
})
});
</script>
答案 0 :(得分:3)
答案 1 :(得分:1)
<script>
$(document).ready(function(){
$('.gbutton').attr('disabled',true);
$('.gbutton').css( "opacity" ,"0.6" );
$('#textid').keyup(function(){
if ($.trim($(this).val()).length) {
$('.gbutton').attr('disabled', false);
$('.gbutton').css("opacity","1");
}
else
{
$('.gbutton').attr('disabled',true);
$('.gbutton').css( "opacity" ,"0.6" );
}
})
});
</script>
答案 2 :(得分:0)
if($(this).val().length !=0){
$('.gbutton').attr('disabled', false);
$('.gbutton').css("opacity","1");
}