टेक्स्ट का रंग वापस करने और सेट करने के लिए, जावास्क्रिप्ट color प्रॉपर्टी का उपयोग करें।
उदाहरण
जावास्क्रिप्ट के साथ टेक्स्ट का रंग वापस करने के लिए निम्न कोड चलाकर देखें:
<!DOCTYPE html> <html> <body> <h2>हेडिंग 2</h2> <p id="myId" style="color:green;">डेमो टेक्स्ट</p> <br> <button type="button" onclick="display()">रंग प्राप्त करने के लिए क्लिक करें</button> <script> function display() { alert(document.getElementById("myId").style.color); } </script> </body> </html>