1
讓我開始說,我是一個JavaScript的初學者,我只是想了解點擊切換。 我正在製作一個網站,如flatuicolors.com,並且當您點擊一個div時,它將複製顏色。我已經將每種顏色的每種顏色寫在P標籤中,並想知道是否可以單擊複製該標籤中的P標籤。點擊複製文本javascript
<div class="main-colour-container col-group-1">
<div class="colours-featured" id="div2">
<div class="colour-box" style="background:#F22613;">
<div class="inside-colour-box">
<div class="colour-box-text fade">
<p>#F22613</p>
</div>
</div>
</div>
<div class="colour-box" style="background:#F44336;">
<div class="inside-colour-box">
<div class="colour-box-text fade">
<p>#F44336</p>
</div>
</div>
</div>
<div class="colour-box" style="background:#C62828;">
<div class="inside-colour-box">
<div class="colour-box-text fade">
<p>#C62828</p>
</div>
</div>
</div>
<div class="colour-box" style="background:#DB3D45;">
<div class="inside-colour-box">
<div class="colour-box-text fade">
<p>#DB3D45</p>
</div>
</div>
</div>
</div>
</div>
可能的重複[如何在JavaScript中複製到剪貼板?](http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript) – 4castle
它已經在這裏回答(http://stackoverflow.com/a/22581382/4804765) – Drkdra
是的,它可能之前已經問過,但我不明白,仍然從該線程,因爲我是一個初學者在javascript – leham789