javascript - Clipboard.js not working in Bootstrap modal -


i trying copy input value clipboard.js: https://clipboardjs.com/. input located in modal:

http://codepen.io/deka87/pen/ebjoky

new clipboard('#copy', {     text: function(trigger) {         return $("#copy-input").val();     } }); 

while works outside of modal, fails work when input , copy button located in modal window. tried init clipboard function after modal window open:

$(".modal").on("shown.bs.modal", function() {   new clipboard('#copy', {       text: function(trigger) {           return $("#copy-input").val();       }   }); }); 

however, didn't solve issue. ideas?

try fork: http://codepen.io/anon/pen/nbxwbq forgot remove console.log ignore :)

<input type="text" class="form-control" id="copy-input" value="copied successfully!"/>     <br />     <a href="#" id="copy" data-clipboard-target="#copy-input" class="btn btn-default">copy input content clipboard</a> 

and

$(".modal").on("shown.bs.modal", function() {   console.log('a', clipboard, $('#copy'), $("#copy-input").val());   var clipboard = new clipboard('#copy') }); 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -