Thanks for helping but actually, I meant for the function to be inside the <script>
tag.
Maybe something like this?:
<p id="message"></p>
<script>
if (get_field('video_id')) {
?><?php
} else {
document.getElementById("message").innerHTML = "Video unavailable";
// Only display "Video unavailable when field "video_id" is empty"
}
</script>
The code above does not work I think because the plugin I am using does not support php. I need to do it with javascript if that is possible.