<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<li class="wb-real-name">
<label class="real-name" for="">真实姓名:</label>
<input type="text" id="input1" placeholder="请输入您的真实姓名" />
</li>
<li class="wb-id-card">
<label class="id-card" for="">身份证号:</label>
<input type="text" id="input2" placeholder="请输入您的身份证号码"/>
</li>
<li class="wb-submit">
<input type="submit" class="submit" id="sb" value="确定">
</li>
<script type="text/javascript" src="jquery-1.9.1.js"></script>
<script type="text/javascript">
$(function(){
$('input').on('input propertychange', function() {
if(($.trim($('#input1').val()) !== "") && ($.trim($('#input2').val()) !== "")){
$('#sb').css('background','#f03468');
} else {
$('#sb').css('background','#999');
}
});
});
</script>
</body>
</html>
原文地址:https://segmentfault.com/q/1010000004137655