JavaScript Code does not work in all browsers

Posted on 2013-02-05
Last Modified: 2013-02-08
Hi Experts,

I have the code below working in IE, but not in Fireiox and Chrome. Can anyone tell me why and how to fix it?

Thank you



<input type="text" id="txt" value="">

<input type="BUTTON" onClick="ClipBoard()" value="Copy to Clipboard" >

<TEXTAREA ID="holdtext" STYLE="display:none;">



    function ClipBoard() {
        holdtext.innerText = txt.value;
        Copied = holdtext.createTextRange();



Open in new window

Question by:APD_Toronto
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
LVL 83

Accepted Solution

Dave Baldwin earned 500 total points
ID: 38856383
It looks like your code is not correct or complete enough.  See here for Mozilla / Firefox info:

Author Comment

ID: 38866343
so, how can i make my code work in both, IE and FF?
LVL 83

Expert Comment

by:Dave Baldwin
ID: 38866380
Try the sample code in the Mozilla link above.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 38866420
i don't understand
LVL 83

Expert Comment

by:Dave Baldwin
ID: 38866475
This page includes a complete Rich-Text editor at the bottom of the page that includes the command you are trying to use.  Make up a test page and try their code.

Author Comment

ID: 38866501
I'm not doing any rich-text editting, i just need to copy to clipboard, as per my code above
LVL 83

Expert Comment

by:Dave Baldwin
ID: 38866638
Did you look at that page and how they are using the commands to copy to the clipboard?

Author Comment

ID: 38866718
I can't see it.  Can you paste the code here please

Author Closing Comment

ID: 38868966
could not figure out

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question