问题
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