I'm trying to fire button click event from another button onchange event. but I got below error after event fired and no button event are NOT working, Below is my code, Can anyone please help me.
<script type="text/javascript">
document.getElementById('btnPropertyUpload').addEventListener('click', openDialog);
function openDialog() {
console.log("funOnchange");
document.getElementById('imgPropertyUpload').click();
}
function funOnchange() {
$('#btnPropertySubmit').click();
}
</script>
<div align="left">
@using (Html.BeginForm("PropertyMaster", "Admin", FormMethod.Post, new { enctype = "multipart/form-data" })) {
<span style="padding:5px 0px 0px 30px;">
@Html.Label("lblPropPhotos", "PROPERTY PHOTOS")
</span>
<button type="button" id="btnPropertyUpload" class="btn-link">
<span class="glyphicon glyphicon-upload col-sm-2"></span>
</button>
<input type="file" id="imgPropertyUpload" style="display:none" name="postedFiles" multiple="multiple" onchange="funOnchange();" />
<input type="submit" value="Upload" id="btnPropertySubmit" style="display:none" />
<br />
if (Model != null && Model.PropDetails.PropertyImages != null)
{
foreach (var image in Model.PropDetails.PropertyImages) {
<img src="@Url.Content(image)" style="width:100px;height:100px; padding:5px 0px 0px 30px;" />
}
}
}
</div>