add copy to clipboard on input click

This commit is contained in:
Adrian Tiberius 2016-09-18 08:57:20 +03:00
parent a659dea180
commit 824c0b8855

View File

@ -88,7 +88,7 @@ $(function() {
fade: {
crossFade: true
}
});
});
var swiper2 = new Swiper('.swiper2', {
loop: true,
autoplay: 2000,
@ -108,6 +108,22 @@ $(function() {
setTimeout(function(){
$('#maitre-field-email input').focus();
},1000);
});
});
var shareLinkInput = $("#shareLinkInput");
shareLinkInput.click(function(test) {
shareLinkInput.focus();
console.log(shareLinkInput);
console.log(test);
shareLinkInput[0].setSelectionRange(0, shareLinkInput.val().length);
try {
succeeded = document.execCommand('copy');
} catch (err) {
succeeded = false;
}
if (!succeeded) {
// Browser doesn't support execCommand
}
});
});