# 在 JS 中使用 Font Awesome 5 图标

**URL:** <https://meta.discourse.org/t/using-font-awesome-5-icon-in-js/108727>\
**Category:** Development\
**Created:** [2019 年2 月 9 日 02:29 UTC](https://meta.discourse.org/t/using-font-awesome-5-icon-in-js/108727 "2019-02-09T02:29:40Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

作者： ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)\
发布日期： [2019 年2 月 9 日 15:38 UTC](https://meta.discourse.org/t/using-font-awesome-5-icon-in-js/108727/3 "2019-02-09T15:38:27Z")

</div>

Something like this should works, but remember to add the new icon in the site setting `svg icon`

```plaintext
 const link = "<a href='"+url+"' target='_blank'><svg class="fa d-icon d-icon-ICON-NAME svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use xlink:href="#ICON-NAME"></use></svg></a>";

```

---

_[View the full topic](https://meta.discourse.org/t/using-font-awesome-5-icon-in-js/108727)._
