I am trying to modify the code found at https://community.esri.com/thread/121245 to use a text field from the attribute table of the layer for the URL of the video. I am new to Javascript, so I'm struggling. I need to change line 7 so that the src is text from my attribute table. thx...
Ruth,
You are using an attribute already from data in that method "pop2000" so it is not much different:
var template = new PopupTemplate();
template.setTitle("<b>City</b>");
template.setContent(getContent); //this will call the getContent function where you can custom build your fields and add video
function getContent(graphic){
var Content = "<b>City Name: </b>" + graphic.attributes.areaname + "<br> <b>Population: </b>" + graphic.attributes.pop2000 + "<br>";
var Hyperlink = '<video width="250" height="250" controls><source src=' + graphic.attributes.videourl + ' type=video/mp4></video> ';
return Content + Hyperlink;
}
Thanks!!!
Ruth,
Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.