我有一个页面,其中包含多个不同状态的复选框(已选中或未选中)。我试图在任何复选框值改变状态时立即启用按钮。
到目前为止,这是我的代码,但它似乎还没有正常工作:
var checkboxes = $("input[type='checkbox']");
checkboxes.change(function(){
$('#saveChanges').prop('enabled', true);
});
答案 0 :(得分:2)
<html>
<head>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(document).ready(function () {
$("input[type='checkbox']").change(function () {
$('#saveChanges').prop('disabled', false);
});
});
</script>
</head>
<body>
<input type="checkbox" value="1" />
<input type="checkbox" value="1" />
<input type="checkbox" value="1" />
<button id="saveChanges" disabled>Save</button>
</body>
</html>
答案 1 :(得分:1)
尝试,提交按钮将在哪里..
14390 Cabourg, France
SELECT t.id,
concat(trim(t.address1), ', ',t.zip, ' ',trim(t.city),
', ',c.countryName
) AS fullAddress
FROM `User` `t`
INNER JOIN Country c ON t.countryCode = c.countryCode
WHERE (((address1 IS NOT NULL
AND zip IS NOT NULL
AND city IS NOT NULL
AND t.countryCode IS NOT NULL)
AND (concat( t.address1, ', ', t.zip, ' ', t.city, ', ', c.countryName )
regexp '^[0-9]+,? [^,]+, [0-9]+,? [^,]+, [a-zA-Z]+$'))
AND (concat(' ',trim(t.address1), ',',t.zip,' ', trim(t.city),
', ', c.countryName) like '%27 Avenue Pasteur, 143%')
)
答案 2 :(得分:0)
尝试,
<input class="myCheckBox" type="checkbox" value="true">
<input class="myCheckBox" type="checkbox" value="true">
<button type="submit" id="confirmButton">BUTTON</button>
var checkboxes = $('.myCheckBox');
checkboxes.on('change', function ()
{
$('#confirmButton').prop('disabled', !checkboxes.filter(':checked').length);
}).trigger('change');