js将输入的字体放大显示案例
<style>
.con{
width: 400px;
height: 60px;
font-size: 24px;
display: none;
border: solid 1px rgba(0, 0, 0, .6);
margin-bottom: 20px;
}
.jd{
font-size: 16px;
}
</style>
<div class="con"></div>
<input type="text" class="jd">
<script>
var con = document.querySelector('.con');
var jd_input = document.querySelector('.jd');
jd_input.addEventListener('keyup', function(){
if(this.value == ''){
con.style.display = 'none';
}else{
con.style.display = 'block';
con.innerText = this.value;
}
})
jd_input.addEventListener('blur', function(){
con.style.display = 'none';
})
jd_input.addEventListener('focus', function(){
if(this.value !== ''){
con.style.display = 'block';
}
})
</script>
转载请注明原文地址:https://ipadbbs.8miu.com/read-2934.html