How to add Javascript Code to an Advanced Custom Field?
-
Hi, I’m trying to do a simple test to understand how Advanced Custom Field works with Java script code.
I created a Text Area Field and added this code below:
<h1 id=”myH”></h1>
<p id=”myP”></p><script>
/*
The code below will change
the heading with id = “myH”
and the paragraph with id = “myP”
*/
document.getElementById(“myH”).innerHTML = “JavaScript Comments”;
document.getElementById(“myP”).innerHTML = “My first paragraph.”;
</script>As a result on the front end of my website instead of seeing:
JavaScript Comments
My first paragraph.
I am seeing this:
/* The code below will change the heading with id = “myH” and the paragraph with id = “myP” */ document.getElementById(“myH”).innerHTML = “JavaScript Comments”; document.getElementById(“myP”).innerHTML = “My first paragraph.”;
What am I doing wrong and how to solve it?
I’d be very very grateful if you could help me over here,
Thanks
Marlos
The page I need help with: [log in to see the link]
- The topic ‘How to add Javascript Code to an Advanced Custom Field?’ is closed to new replies.