ISSUE: Unable to provide input in the input fields
// Enable dragging for the DIV element:
dragElement(document.getElementById("mydiv"));
function dragElement(elmnt) {
var pos1 = 0,
pos2 = 0,
pos3 = 0,
pos4 = 0;
if (document.getElementById(elmnt.id + "header")) {
// Check if the header is present:
document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
} else {
// If not, allow dragging from anywhere inside the DIV:
elmnt.onmousedown = dragMouseDown;
}
function dragMouseDown(e) {
e = e || window.event;
e.preventDefault();
// Get initial mouse cursor position:
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
// Call this function on cursor movement:
document.onmousemove = elementDrag;
}
function elementDrag(e) {
e = e || window.event;
e.preventDefault();
// Calculate new cursor position:
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
// Update element's position:
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
}
function closeDragElement() {
// Stop drag operation on mouse button release:
document.onmouseup = null;
document.onmousemove = null;
}
}
#mydiv {
width: 50%;
position: absolute;
}
#mydivheader {
padding: 1px;
cursor: move;
z-index: 10;
color: rgb(211, 211, 211);
}
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="afcdc0c0dbdcdbddcedfef9a819e819c">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d6b4b9b9a2a5a2a4b7a696e3f8e7f8e5">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<!-- Draggable DIV -->
<div id="mydiv" class="mydiv">
<!-- Include a header DIV with the same name as the draggable DIV, followed by "header" -->
<div id="mydivheader" class="card">
<div class="card-body">
<div class="row">
<div class="col-sm-10">
<div class="row">
<div class="col">
<input type="text" class="form-control" placeholder="Add Title">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-8">
<input type="date" id="date_start" class="form-control">
</div>
<div class="col-sm-2">
<input type="time" id="time_start" class="form-control">
</div>
<div class="col-sm-2">
<input type="time" id="time_end" class="form-control">
</div>
</div>
<br>
<div class="row">
<div class="col">
<textarea class="form-control" rows="6" placeholder="Description...."></textarea>
</div>
</div>
<br>
<div class="row">
<div class="col">
<input type="submit" class="btn btn-primary btn-block" value="Save">
</div>
</div>
</div>
<div class="col-sm-2">
<button id="hide_card" onclick="hide(event)" class="btn btn-danger">X</button>
</div>
</div>
</div>
</div>
</div>