引入.js文件
jQuery
<scripttype="text/javascript"src="./jquery-1.11.3.min.js"></script>
代码的详细解读,可以参考视频教程。
新建 html 文件 22-jQuery.html
,编写下方程序,运行看看效果吧
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<metahttp-equiv="X-UA-Compatible"content="IE=edge">
<metaname="viewport"content="width=device-width, initial-scale=1.0">
<scriptsrc="./jquery-1.11.3.min.js"></script>
<title>jQuery</title>
</head>
<body>
<inputid="mytext"type="text"/>
<buttononclick="getValue()">获取输入框内容</button>
<scripttype="text/javascript">
function getValue(){
// let value = document.getElementById('mytext').value
let value = $('#mytext').val()
alert(value)
}
</script>
</body>
</html>
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有