Copy Text and HTML to Clipboard

library to copy the string and html parameters to the clipboard

2024-04-07 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트는 직접 설치하는 용도가 아닙니다. 다른 스크립트에서 메타 지시문 // @require https://update.greatest.deepsurf.us/scripts/491896/1355860/Copy%20Text%20and%20HTML%20to%20Clipboard.js을(를) 사용하여 포함하는 라이브러리입니다.

작성자
escctrl
버전
1.0
생성일
2024-04-07
갱신일
2024-04-07
크기
1.47KB
라이선스
MIT

Call with copy2Clipboard(event, string[, html]) where

  • event is the triggering user event (for example, a button click); this is required in case the user doesn't have the Clipbord API enabled and the event.clipBoardData method is used as a fallback
  • string is the plaintext that shall be copied to clipboard
  • html (optional) is the HTML equivalent that shall be copied to clipboard; if html is not specified, string is set as html content

For example:

$(button).on('click', (ev) => {
    copy2Clipboard(ev, "hello world", "<strong>hello world</strong>");
});