jQuery/JavaScript - Allow CTRL + Click to open link in new tab

前端 未结 3 2071
悲哀的现实
悲哀的现实 2021-02-14 02:12

Is there a way in jQuery or JavaScript to enable the user to CTRL + Click a link to open a link in a new tab like example element?

3条回答
  •  南笙
    南笙 (楼主)
    2021-02-14 02:58

    On Macintosh keyboards, this is the ⌘ Command key. On Windows keyboards, this is the Windows key (⊞ Windows).

    For more see this page:

    https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey

提交回复
热议问题