I have a <img/>
tag in my .cshtml page..
<img id="ImageID" alt="" width="100%" height="100%" />
I need to set src attribute dynamically by selecting the image file path using file control.
I tried the following code in my Js page, but it is not working.
var image_path = $("#fileControl").val();
$("#ImageID").attr('src', 'url(' + image_path + ')');
Please help!
Thanks.
$("#ImageID").attr('src', $("#fileControl").val());
– Dharman Feb 21 at 12:24.val()
. Otherwise you could just set the javascript with your razor anyway, in the same way you're setting the #fileControl value – danrichardson Feb 21 at 12:34