1
<div>
어떻게 마크 업을 복사 - 그냥 일반 텍스트가 아닌를 - 클립 보드에 자바 스크립트
<div id="myElement">
Mary had a little <b>lamb</b>, its <i>fleece</i> was white as snow. Everywhere that mary went, the lamb was sure to go.
</div>
의 전체 콘텐츠를 무료로 유산을 사용하여이 코드
const copyAll = document.querySelector("myElement");
window.getSelection().selectAllChildren(copyAll);
document.execCommand("Copy");
window.getSelection().removeAllRanges();
를 사용하여 클립 보드에 복사해야 (execCommand가 작동하려면 이벤트 리스너를 통해 호출을 실행해야합니다.)
텍스트 내용 만입니다. 복사 됨. 기존의 firefox 클립 보드 애드온에 의존하는 및 <b>
태그) 을없이 복사 할 수 있습니까?
니스 우회 - 다른 옵션이없는 경우,이 가능한 솔루션이 될 것입니다. 고맙습니다. –