0

I implemented a function to copy text to clipboard in HTML page using JavaScript. Is there any way to change the design of this prompt box, like make it smaller and change its positioning?

I'm open to suggestions of implementing this with jQuery, if this is possible...

I know that there are other questions similar to this, but they don't answer mine...

jsfiddle: https://jsfiddle.net/e9nt6xy5/

HTML:

<div id="test">Some text here</div>

JS:

function copyToClipboard(text) {
    window.prompt("Copy to clipboard: Ctrl+C, Enter", text);
}

// Use JQuery
//
$('#test').click(function() {
    copyToClipboard('bobo')
});
Valip
  • 4,440
  • 19
  • 79
  • 150
  • Quentin, there is another question similar to this, but it doesn't have the answer that helps me – Valip Nov 23 '15 at 18:14
  • I disagree with this being a duplicate, because the better answer is going to be a long version of "don't use window.prompt". – Joshua Nov 23 '15 at 18:43
  • In what way doesn't it answer your question? If you have other requirements, you should edit your queston to give more details. – ekhumoro Nov 23 '15 at 18:45
  • It is a duplicate, you can't change the way prompt looks. However, the question that this linked to doesn't have an accepted answers. Should that be allowed? To say that a question is a duplicate of one that doesn't have an accepted answer? – Ruan Mendes Nov 23 '15 at 19:53
  • That's what I'm saying, @JuanMendes, that question doesn't have an accepted answer. – Valip Nov 23 '15 at 20:35
  • Moreover, I also mentioned that I'm looking for a jQuery solution and maybe someone has it.. – Valip Nov 23 '15 at 20:42
  • @JuanMendes. A question may have multiple valid answers that provide alternative solutions/explanations. The accepted answer is merely the one the OP found most useful (if any). The "best" or "most correct" answer is decided by the community via up/down voting. – ekhumoro Nov 25 '15 at 18:02
  • @PavelValeriu. Your original question has been answered by the one linked above. But as it says: "If those answers do not fully address your question, please ask a new question". However, what you should actually do *first* is search SO for something like this: [`[jquery] alert custom`](http://stackoverflow.com/search?q=[jquery]+alert+custom). Because you don't want to ask *another* duplicate question - right? – ekhumoro Nov 25 '15 at 18:15

0 Answers0