JavaScript DOM-exercise-4|jQuery .attr()用法
May 13, 2022
前言:原本是寫劇評心得的medium,時隔多日也沒再更新,因為都更新到我的wordpress了XD如果還是想看劇的話還是追蹤我的IG比較好哈哈哈哈,這裡以後應該會多更新一些前端技術筆記,真的很不好意思因為影劇訂閱我的人哈哈哈ㄏ。
練習題來源與官方解法:https://www.w3resource.com/javascript-exercises/javascript-dom-exercise-4.php
Write a JavaScript function to get the value of the href, hreflang, rel, target, and type attributes of the specified link.
寫一個可以取得一個連結的所有屬性的JS程式。
這題也是偏簡單,知道語法就好了
$(“#w3r”).attr(“href”)
取得href$(“#w3r”).attr(“hreflang”)
取得hrelang$(“#w3r”).attr(“rel”)
取得rel$(“#w3r”).attr(“target”)
取得target$(“#w3r”).attr(“type”)
取得type
今天這題偏無聊一點~