How to copy to clipboard with multiple button ids using jquery
<p>I am trying to copy data on clipboard onclick event, but I am unable to do it for multiple input ids. Here is my code and reference stackoverflow url:
<a href="https://stackoverflow.com/questions/31593297/using-execcommand-javascript-to-copy-hidden-text-to-clipboard">Using execCommand (Javascript) to copy hidden text to clipboard</a></p>

<p>and my code for request is:</p>

<pre><code>&lt;body&gt;
&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;input  id="copy-me" value="mohit text" type="text" class="copy"&gt;
&lt;button id="copy-btn" onclick="idname(this.id, 'copy-me')"&gt;Copy&lt;/button&gt;&lt;br&gt;&lt;br&gt;
&lt;input id="copy-me1" value="mohit text2" type="text" class="copy"&gt;
&lt;button id="copy-btn1" onclick="idname(this.id, 'copy-me')"&gt;Copy&lt;/button&gt;&lt;br&gt;&lt;br&gt;
&lt;input id="copy-me2" value="mohit text3" type="text" class="copy"&gt;
&lt;button id="copy-btn2" onclick="idname(this.id, 'copy-me')"&gt;Copy&lt;/button&gt;&lt;br&gt;&lt;br&gt;
&lt;textarea placeholder="paste here"&gt;&lt;/textarea&gt;
&lt;script type="text/javascript"&gt;
    function idname(a, b)
    {
        alert(a);
        var copyBtn = $(a),
                input = $(b);
        copyBtn.on('click', copyToClipboard);
        function copyToClipboardFF(text) {
            window.prompt("Copy to clipboard: Ctrl C, Enter", text);
        }
        function copyToClipboard() {
            var success = true,
                    range = document.createRange(),
                    selection;
            // For IE.
            if (window.clipboardData) {
                window.clipboardData.setData("Text", input.val());
            } else {
                // Create a temporary element off screen.
                var tmpElem = $('&lt;div&gt;');
                tmpElem.css({
                    position: "absolute",
                    left: "-1000px",
                    top: "-1000px",
                });
                // Add the input value to the temp element.
                tmpElem.text(input.val());
                $("body").append(tmpElem);
                // Select temp element.
                range.selectNodeContents(tmpElem.get(0));
                selection = window.getSelection();
                selection.removeAllRanges();
                selection.addRange(range);
                // Lets copy.
                try {
                    success = document.execCommand("copy", false, null);
                }
                catch (e) {
                    copyToClipboardFF(input.val());
                }
                if (success) {
                    alert("The text is on the clipboard, try to paste it!");
                    // remove temp element.
                    tmpElem.remove();
                }
            }
        }
    }

&lt;/script&gt;
</code></pre>

<p></p>