當前位置:
首頁 >
JavaScript-初识jQuery及公式
發布時間:2024/9/27
31
豆豆
生活随笔
收集整理的這篇文章主要介紹了
JavaScript-初识jQuery及公式
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
jQuery官網: https://jquery.com/
參考文檔: https://jquery.cuishifeng.cn/
jQuery庫,里面封裝大量JavaScript函數,相當于JavaScript的工具類
獲取jQuery
方式一,通過cdn引入
https://www.bootcdn.cn/jquery/
https://cdn.baomitu.com/jquery
https://www.jq22.com/cdn/
方式二,下載后導入
<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><title>Title</title><!-- cdn 引入 --> <!-- <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>--><script src="lib/jquery-3.6.0.js"></script> </head> <body> </body> </html>jQuery公式
公式:$(selector).action()
<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><title>Title</title><!-- cdn 引入 --> <!-- <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>--><script src="lib/jquery-3.6.0.js"></script> </head> <body><a href="https://www.baidu.com/" id="test-jquery">點我</a><script>// 選擇器就是css的選擇器$('#test-jquery').click(function () {alert('hello, jQuery')})// // js原始寫法// let test_id = document.getElementById('test-jquery')// // test_id.click() // 點擊這個按鈕// test_id.onclick = () => {// alert('hello, jQuery')// } </script> </body> </html>https://www.bilibili.com/video/BV1JJ41177di?p=26
總結
以上是生活随笔為你收集整理的JavaScript-初识jQuery及公式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 前端_网页编程 Form表单与模板引擎(
- 下一篇: JavaScript从入门到放弃 -(五