我现在是想实现,当我在input框里面输入值的时候,把获取到的值添加到span中。现在遇到两个问题;
1.只能把值添加到一个span里面,多个就不行;
2.input框清空后,span的值页没了!
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="css/ceshi1.css">
<script type="text/javascript" src="js/index.js"></script>
</head>
<body>
<input type="text" class="ceshi">
<span class="spa1"></span>
<span class="spa2"></span>
<span class="spa3"></span>
<script type="text/javascript" src="js/jq.js"></script>
<script type="text/javascript" src="js/ceshi1.js"></script>
</body>
</html>
$(document).ready(function(){
$('.ceshi').blur(function(){
var val = $('.ceshi').val()
$(".spa1").html("<a href='#' class=delt>删除</a>");
$(".spa1").text(val)
});
});
求大神指点一下!!!
jeck猫
相关分类