HTML <del> तत्व से जुड़ी HTML DOM del cite प्रॉपर्टी का उपयोग उपयोगकर्ता को यह बताने के लिए किया जाता है कि वेबसाइट पर कुछ टेक्स्ट क्यों हटाया गया था। यह उस URL को निर्दिष्ट करके ऐसा करता है जिसमें बताया गया है कि दिया गया टेक्स्ट क्यों हटाया गया था।
del cite प्रॉपर्टी हमारी वेबसाइट की पहुंच बढ़ाती है क्योंकि इसका कोई दृश्य संकेत नहीं होता लेकिन यह स्क्रीन रीडर्स की मदद कर सकती है। del cite प्रॉपर्टी HTML <del> तत्व के cite एट्रिब्यूट के मान को सेट या रिटर्न करती है।
सिंटैक्स
cite प्रॉपर्टी सेट करने के लिए सिंटैक्स निम्नलिखित है:
delObject.cite = URL
यहां, URL उस दस्तावेज़ का URL निर्दिष्ट करता है जो बताता है कि टेक्स्ट क्यों हटाया गया था। URL सापेक्ष या निरपेक्ष हो सकता है।
उदाहरण
HTML DOM del cite प्रॉपर्टी का एक उदाहरण देखते हैं:
<!DOCTYPE html> <html> <head> <title>Del cite</title> <style> #Sample{color:blue}; </style> </head> <body> <h2>del cite property example</h2> <p><del id="Del1" cite="sampleDeleted.html">Some text has been deleted</del></p> <p>Click the below button to change the cite attribute value of the above deleted text</p> <button onclick="citeChange()">Change Cite</button> <p id="Sample"></p> <script> function citeChange() { document.getElementById("Del1").cite = "https://example.com/deletedText.html"; document.getElementById("Sample").innerHTML = "The del cite attribute value was changed to 'https://example.com/deletedText.html'."; } </script> </body> </html>
आउटपुट
यह निम्नलिखित आउटपुट उत्पन्न करेगा:

Change Cite बटन पर क्लिक करने पर:

उपरोक्त उदाहरण में:
हमने पहले एक <p> तत्व के अंदर id "Del1" के साथ एक <del> तत्व बनाया जिसमें del तत्व के लिए cite एट्रिब्यूट मान "sampleDeleted.html" पर सेट है।
<p><del id="Del1" cite="sampleDeleted.html">Some text has been deleted</del></p>
हमने फिर एक "Change Cite" बटन बनाया जो उपयोगकर्ता द्वारा क्लिक किए जाने पर citeChange() मेथड को निष्पादित करेगा:
<button onclick="citeChange()">Change Cite</button>
citeChange() मेथड getElementById() मेथड का उपयोग करके <del> तत्व प्राप्त करता है और इसके cite प्रॉपर्टी मान को "https://example.com/deletedText.html" में बदल देता है। हम फिर इस परिवर्तन को id "Sample" वाले पैराग्राफ में पैराग्राफ तत्व के innerHTML प्रॉपर्टी का उपयोग करके प्रदर्शित करते हैं। "Sample" पैराग्राफ के अंदर का टेक्स्ट नीले रंग में प्रदर्शित होता है क्योंकि हमने इसकी id से मेल खाने वाली स्टाइल लागू की है:
function citeChange() { document.getElementById("Del1").cite = "https://example.com/deletedText.html"; document.getElementById("Sample").innerHTML = "The del cite attribute value was changed to 'https://example.com/deletedText.html'."; }