<html>
<meta charset="UTF-8" />
<head>
<title></title>
</head>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<style type="text/css">
</style>
<body>
<label class="goal">label的text默认内容</label>
<input type="text" name="" id="mytext" value="" placeholder="输入内容,改变左边文字" />
<button id="confirm">点击赋值以及获取</button>
</body>
<script type="text/javascript">
$(function() {
$('#confirm').click(function() {
var newstr = $('#mytext').val()
$('.goal').text(newstr)
alert('你获取了label的text:' + $('.goal').text())
})
})
</script>
</html>