IE 10 다음 버전 placeholder에 대한 호환성 솔루션



<!--  IE 10  placeholder  -->
<!--[if lt IE 10]>
<script>
$(function(){
	
	$("input[type!='password'],textarea").bind({
		"focus":function(){
			var placeholderVal = $(this).attr("placeholder");
			var realVal = $(this).val();
			if($.trim(realVal)==placeholderVal){
				$(this).val("");
			}
		},
		"blur":function(){
			var placeholderVal = $(this).attr("placeholder");
			var realVal = $(this).val();
			if($.trim(realVal)==""){
				$(this).val(placeholderVal);
			}
		}
	});
	
	$("input[type!='password'],textarea").each(function(i,n){
		$(this).val($(this).attr("placeholder"));
	});
	
	
	$("input[type='password']").bind({
		"focus":function(){			
			var placeholderVal = $(this).attr("placeholder");
			var realVal = $(this).val();
			if($.trim(realVal)==placeholderVal){
				var copy_this = $(this).clone(true,true);
				$(copy_this).attr("type","password");
				$(copy_this).insertAfter($(this));
				$(this).remove();				
				$(copy_this).val("");
				$(copy_this).focus();
			}
		},
		"blur":function(){			
			var placeholderVal = $(this).attr("placeholder");
			var realVal = $(this).val();
			if($.trim(realVal)==""){
				var copy_this = $(this).clone(true,true);
				$(copy_this).attr("type","text");
				$(copy_this).insertAfter($(this));
				$(this).remove();				
				$(copy_this).val(placeholderVal);
			}
		}
	});
	
	$("input[type='password']").each(function(i,n){
		var placeHolderVal = $(this).attr("placeholder");
		var copy_this = $(this).clone(true,true);
		$(copy_this).attr("type","text");
		$(copy_this).insertAfter($(this));
		$(this).remove();
		$(copy_this).val(placeHolderVal);				
	});
});
</script>
<![endif]-->
계속 업데이트,


<input type="password" id="loginPassword" placeholder=" (6-16 )" class="width270">
	          	<input type="text" passwordMask="true" placeholder=" (6-16 )" style="display:none;" class="width270">

좋은 웹페이지 즐겨찾기