0
我正在嘗試製作顏色選擇器。
當將鼠標懸停在圓弧上時,應該突出顯示裏面的文本,以便用戶可以按ctrl-c進行復制。 我已經有了正確的元素。 在Google上搜索「選擇文本」等不會產生很好的結果。選擇用d3.js複製的文本
text.on('mouseover',function() {
"this"- object is the text that should get highlighted.
// Select text so user can press ctrl-c to copy...
});
我知道有是this.select()jQuery中,但有什麼在d3.js(或常規的JavaScript)相似?
D3中沒有這樣的東西。 –
您是否嘗試過此鏈接的解決方案(http://www.sitepoint.com/forums/showthread.php?459934-selecting-text-inside-lt-div-gt)? – Yogesh
謝謝。像魅力一樣工作。 – GusOst