Say I have a div with innerHTML set using the HTML code for a rocket: 🚀
How do I do a conditional test for that character in javascript?
E.g. how do I get below to log "rocket"
let rocket = document.getElementById("rocket")
if (rocket.innerHTML == "🚀") console.log("rocket")
else console.log("no rocket");
<div id="rocket">
🚀
<div>
Aucun commentaire:
Enregistrer un commentaire