Webcam.js Error: Could not locate DOM element to attach to

社会主义新天地 提交于 2019-12-11 16:56:41

问题


I am trying to use Webcam.js to capture image in my MVC project. But at the initial level I have an issue "Could not locate DOM element to attach to."

I have attached script


<style>
    .Camera {
        width: 320px;
        height: 240px;
        border: 1px solid black;
    }
</style>
<script type="text/javascript" src="~/Scripts/webcam.min.js"></script>
<script language="JavaScript">
    Webcam.set({
        width: 320,
        height: 240,
        image_format: 'jpeg',
        jpeg_quality: 90
    });
     Webcam.attach('#Camera');
</script>

In View

 <div>
       <div id="Camera" class="Camera"> </div>
    <br>
    <input type="button" id="takeshot" value="Capture" onClick="take_snapshot()" />
 </div>

What is the possible cause?

来源:https://stackoverflow.com/questions/58910224/webcam-js-error-could-not-locate-dom-element-to-attach-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!