-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhtmlbits.py
27 lines (25 loc) · 918 Bytes
/
htmlbits.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
html_head = """<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Product Page</title>
<link rel="stylesheet" href="style.css">
<script>
document.addEventListener("DOMContentLoaded", function() {
var copyButtons = document.querySelectorAll(".copyButton");
copyButtons.forEach(button => {
button.addEventListener("click", function() {
var textToCopy = this.getAttribute("data-text-to-copy");
navigator.clipboard.writeText(textToCopy).then(function() {
console.log("Successfully copied to clipboard: " + textToCopy);
// Provide user feedback here, like changing the icon or displaying a tooltip
}).catch(function(err) {
console.error("Error in copying text: ", err);
});
});
});
});
</script>
</head>
"""