I’ve just started using ACF and very new to JS – I’m trying to use the acf.getField() function to return the value in a field within a post.
Here is the code i have:
var myimage1 = acf.getField('image1');
//test the variable loaded
document.getElementById("ImageURL").src = myimage1;
When this loads its outputs [object Object]
I suspect i need to reference a specific value? i’ve seen references to acf.getField(‘image1’).val() – but when i try this i get nothing back.
Anyone able to give me some direction on the correct calli need to make to get the value passed back? for reference this field is a URL.
Any help would be appreciated.