पाठ को क्लिपबोर्ड में कैसे नक़ल करें
- पिछला पृष्ठ नंबर शिल्पकारी छुपाएं
- अगला पृष्ठ एनिमेशन सर्च
जेसकैप्टिंग को क्लिपबोर्ड में नक़ल करने के लिए JavaScript का उपयोग सीखें。
इस बटन पर क्लिक करके पाठ क्षेत्र से पाठ नक़ल कर सकते हैं。
पाठ को क्लिपबोर्ड में नक़ल करें
पहला कदम - HTML जोड़ें:
<!-- 文本字段 --> <input type="text" value="Hello World" id="myInput"> <!-- पाठ नक़ल करने के लिए बटन--> <button onclick="myFunction()">पाठ नक़ल करें</button>
दूसरा कदम - जेसक्रिप्ट जोड़ें:
function myFunction() { // टैक्स्ट फ़ील्ड प्राप्त करें var copyText = document.getElementById("myInput"); // टैक्स्ट फ़ील्ड को चुनें copyText.select(); copyText.setSelectionRange(0, 99999); // मोबाइल डिवाइस के लिए // टैक्स्ट फ़ील्ड में टैक्स्ट नक़ल करें navigator.clipboard.writeText(copyText.value); // नक़ल किये गये पाठ की चेतावनी दें alert("Copied the text: " + copyText.value); }
टूलटिप में नक़ल किये गये पाठ दिखाएं
एससीएस जोड़ें:
.tooltip { position: relative; display: inline-block; } .tooltip .tooltiptext { visibility: hidden; width: 140px; background-color: #555; color: #fff; text-align: center; border-radius: 6px; padding: 5px; position: absolute; z-index: 1; bottom: 150%; left: 50%; margin-left: -75px; opacity: 0; transition: opacity 0.3s; } .tooltip .tooltiptext::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border-width: 5px; border-style: solid; border-color: #555 transparent transparent transparent; } .tooltip:hover .tooltiptext { visibility: visible; opacity: 1; }
- पिछला पृष्ठ नंबर शिल्पकारी छुपाएं
- अगला पृष्ठ एनिमेशन सर्च