复选框勾选颜色问题IE

时间:2017-03-17 11:37:07

标签: jquery html css internet-explorer

我正在使用附加代码更改刻度线颜色,它在Chrome中正常工作但在IE中无效。请帮忙

IE代码因外观不允许而更新



$('input+div').on('click', function(){    
	   debugger;
	   
        if ($(this).prev().prop('checked')==false){ 
           $(this).prev().attr('checked', true);  
        }
	   else{
	      $(this).prev().attr('checked', false);  
        }
        $(this).toggleClass("checkbox-checked-replica");	   		
      });

.checkbox-checked-replica{
    height: 20px;
    width: 20px;
    border: solid 1px;
    vertical-align: middle;
	display: inline-block;
	background: url(https://i.stack.imgur.com/Wxukt.png) no-repeat center;
	}
	.checkbox-unchecked-replica{
    height: 20px;
    width: 20px;
    border: solid 1px;
    vertical-align: middle;	
	display: inline-block;
	}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="checkbox" style=" border: solid 1px #a1a6ac;height:20px;width:20px">
<div class="checkbox-unchecked-replica"></div>
&#13;
&#13;
&#13;

js - &gt;

$('input[type="checkbox"]').change(function() {
  var imageURL = 'https://i.stack.imgur.com/Wxukt.png';
  var c = this.checked ? ($(this).css('-webkit-appearance', 'none'),
    $(this).css('-moz-appearance', 'none'), $(this).css(' appearance', 'none'), $(this).css('background-position', 'center'), $(this).css('background-repeat', 'no-repeat'), $(this).css('background-image', 'url(' + imageURL + ')')) : $(this).css('-webkit-appearance', 'checkbox');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="checkbox" style=" border: solid 1px #a1a6ac;height:20px;width:20px">
<div class="checkbox-unchecked-replica"></div>

0 个答案:

没有答案