複製代碼代碼如下:
<!doctype html>
<html lang =“ en”>
<頭>
<meta charset =“ utf-8”>
<title>文檔</title>
</head>
<身體>
<輸入type =“ text” id =“ msg”>
<a href =“#” id =“結果”>提交</a>
<div id =“ show”> </div>
<script src =“ jquery1.11.js”> </script>
<script>
$(function(){
var flag = true;
$(“#result”)。on('click',function(){
如果(flag){
flag = false;
}別的{
返回;
}
$(“#show”)。html('<p>'+$(“#msg”)。val()+'</p>');
});
}))
</script>
</body>
</html>
太容易了!