if
(document.getElementById("checkid").innerText.length > 0){
console.log("yes"); // what should be done if there is content
}
else{
console.log("no"); // what should be done if there is no content
};
Fachbeitrag: Neuromarketing und Conversions
Check if a specified ID has content. If yes, do something. In this example I specify the ID with „#checkid“. Do stuff if there is content – or if not.
if
(document.getElementById("checkid").innerText.length > 0){
console.log("yes"); // what should be done if there is content
}
else{
console.log("no"); // what should be done if there is no content
};
WHERE TO PLACE THIS CODE?
Run it within your tag manager or put it on your desired page. Either within a script file, or within the <style> ... </style>
tags.
Please share your thumbsup, suggestions, edits, and questions within my comment section down there.
I love posting snippets for you, but with a bit of feedback, it gets even more fun. 😀
Jeder mag Cookies! Du kannst alle Cookies akzeptieren oder in den Cookie Settings auswählen, welche genutzt werden dürfen.
Name | Domain | Zweck | Ablauf | Art |
---|---|---|---|---|
wpl_user_preference | eboosting.net | WP GDPR Cookie Consent Preferences | 1 year | HTTP |
Name | Domain | Zweck | Ablauf | Art |
---|---|---|---|---|
_ga | eboosting.net | Google Universal Analytics long-time unique user tracking identifier. | 2 years | HTTP |
_gid | eboosting.net | Google Universal Analytics short-time unique user tracking identifier. | 1 day | HTTP |
_gat_UA-60203069-1 | eboosting.net | Google Analytics tracking cookie. | Session | HTTP |
Analytics | eboosting.net | Analytics Tracking | 1 year | HTTP |