please check the image i attached,
here is my current code,
$("#button1").on("click", function() { var radio1 = $("input[name='option1']:checked").val(); var radio2 = $("input[name='option2']:checked").val(); var radio3 = $("input[name='option3']:checked").val(); var radio4 = $("input[name='option4']:checked").val(); var qstring = "1. " + radio1 + "<br /> " + "2. " + radio2 + "<br />" + "3. " + radio3 + "<br />" + "4. " + radio4; var result2 = qstring.fontsize(3); document.getElementById("Center").innerHTML = result2; result2.select(); document.execCommand("Copy"); });
Now I know the answer. You just have to call the div id which the result is being display.
$("#button1").on("click", function(){
var target = document.getElementById("Center");
var range, select;
if (document.createRange) {
range = document.createRange();
range.selectNode(target)
select = window.getSelection();
select.removeAllRanges();
select.addRange(range);
document.execCommand('copy');
select.removeAllRanges();
} else {
range = document.body.createTextRange();
range.moveToElementText(target);
range.select();
document.execCommand('copy');
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.