I need to use JavaScript inside my Razor syntax. This is my JavaScript function. I need to get my element ID and based on this, I try to get Image URK from list of images of my model.
<script>
function pickThisPicture(element) {
var id = element.id;
document.getElementById("big-picture").src = "@Url.Content(Model.Images[id].Url)";
}
</script>
How can I put the ID of an element sent to the function to the Model.Images object?
I tried something like this, but none of it worked:
document.getElementById("big-picture").src = "@Url.Content(Model.Images[@:id].Url)";
document.getElementById("big-picture").src = "@Url.Content(Model.Images[<text>id</text>].Url)";
Thank you.