如何在选择 #custom 时将 .css("opacity","1") 添加到 #ifedit,但在另一个选择中它将为 #ifedit 添加 opacity=.5?
$(function() {
$('#ifedit').prop('disabled',true);
$('#drpevent').on('change', function(){
$('#ifedit').prop('disabled', $(this).val() !== 'custom');
});
});
最佳答案
$(function() {
$('#ifedit').prop('disabled', true);
$('#drpevent').on('change', function() {
$('#ifedit').prop('disabled', $(this).val() !== 'custom');
if ($('#drpevent').val() == 'custom') {
$('#ifedit').css('opacity', '1');
} else {
$('#ifedit').css('opacity', '0.5');
}
});
});
关于jquery - 通过使用 jQuery 选择的下拉列表更改输入的不透明度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29030111/