如何连接两个字符串并在剪贴板中获取值?
var url = "www.myurl.123";
var img = document.getElementById("myInput2").value;
var optionValue = url + " " + img;
optionValue.select();
document.execCommand("copy");
alert("Img path: " + optionValue.value);
答案 0 :(得分:1)
您可以将其添加到输入值
var url = "www.myurl.123";
var img = document.getElementById("myInput2")
img.value = url + " " + img.value
img.select();
document.execCommand("copy");
alert("Img path: " + img.value);
<input id="myInput2" value="image"/>