passing javascript variable to html5 video source -
i want pass javascript variable src html5 video video changes dynamically based on js variable value. not able achieve <script type="text/javascript"> var path = "/api/videos/mp4/"; var filename = '@viewbag.filename'; var fullpath = path.concat(filename); document.getelementbyid('fullpath1').src = fullpath.tostring(); </script> <p><script type="text/javascript">document.write(fullpath)</script></p> <video width="480" height="320" controls="controls" autoplay="autoplay"> <source src="fullpath1" type="video/mp4"> </video> please me working. thanks! you looking element id document.getelementbyid('fullpath1').src = fullpath.tostring(); but haven't yet define id: <source src="fullpath1" type="video/mp4"> ...