/    Sign up×
Community /Pin to ProfileBookmark

Copy multiple span id’s to clipboard

Hi

I am using the following copy to clipboard function.
It allows to copy 1 text area and copy to clipboard.

However i have multiple div’s that show/hide by clicking a radio button.

I want to be able to “copy to clipboard” ALL the text that displays in any divs that are visible(div’s become visible on the page once radio button is selected).

[CODE]
<SCRIPT LANGUAGE=”JavaScript”>
function ClipBoard()
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand(“Copy”);
}
</script>

<div class=”row” id=”div-1a-N” style=”display:none”><span ID=”copytext”>Internet issue</span></div>

<div class=”row” id=”div-2adsla-N” style=”display:none”><span ID=”copytext”>User offline</span></div>

<div class=”row” id=”div-3adsla-N” style=”display:none”><span ID=”copytext”>Account active</span></div>

<TEXTAREA ID=”holdtext” STYLE=”display:none;”></TEXTAREA>
<BUTTON onClick=”ClipBoard();”>Copy to Clipboard</BUTTON>
[/CODE]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@drdre89authorMar 29.2009 — yes i realise that
Copy linkTweet thisAlerts:
@felgallMar 30.2009 — innerText and the clipboard only wirk with Internet Explorer.
Copy linkTweet thisAlerts:
@drdre89authorMar 31.2009 — innerText and the clipboard only wirk with Internet Explorer.[/QUOTE]

yes i know that. its being used for an intranet that only uses IE6
×

Success!

Help @drdre89 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...