JSFiddle - React, Tailwind, and code Playground
HTML
<!--Wrapper div-->
<div id="wrapper">
<!--Inbox list and button to add a card-->
<div id="inboxList" class="cellContainer">
<p style="display: inline">Inbox</p>
<!--Button to add a Card-->
<input type="button" id="AddCardBtn" value="+ Add a Card..." />
<hr class="fancy-line" />
<br/>
<!--Card div-->
<div id="userAddedCard">
<br/>
<div></div>
</div>
</div>
</div>
<!--Modal Dialog-->
<div id="modalDialog">
<form>
<label>Title</label>
<input type="text" id="customTextBox" value="some value" />
<p>Date:
<input type="text" id="datepicker" value="some date" />
</p>
<input type="button" id="Getbtn" value="Get value" />
<hr/>
<br/>
</form>
</div>
<!--Reference to Jquery-->
CSS
/*Style of a body*/
body {
background-color: #f4f4f4;
}
.sto {
height : 25px;
width : 10px;
background-color: grey;
}
.ctb {
display:inline-block;
width: 20px;
padding-left:2%;
}
.image {
display:inline-block;
height:19px;
width:19px;
padding-top:7%;
padding-left:5%;
}
/*Style of a Wrapper*/
#wrapper {
margin-top: 3%;
margin-right: 20%;
height: 715px;
min-width: 300px;
min-height: 715px;
background-color: #00CCFF;
box-shadow: 7px 7px 7px #828282;
border-radius: 6px;
}
/*Style of a inbox list*/
#inboxList {
width: 275px;
height: 700px;
background-color: #f0f0f0;
border: 1px solid black;
margin-left: 0.5%;
margin-top: 0.4%;
border-radius: 10px;
box-shadow: 7px 7px 7px #828282;
overflow: auto;
}
/*Style of a Modal Dialog*/
#modalDialog {
display: none;
background-color: white;
border: solid black 2px;
border-radius: 10px;
overflow: auto;
box-shadow: 7px 7px 7px #828282;
}
/*Style of a card*/
.cellContainer .sortable-div {
background: whitesmoke;
width: 260px;
height: 150px;
margin-left: 2.3%;
border-radius: 10px;
border: 2px solid black;
box-shadow: 0px 7px 7px #828282;
margin-bottom: 1%;
}
JavaScript
$(function () {
// Click function to add a card
var $div = $('<div />').addClass('sortable-div');
$('<div />', {
$('<img />', {
"src": "/Pages/Images/calendar.png"
}).addClass('image').appendTo($div);
$('<input/>', {
"type": "text",
"class": "ctb"
}).addClass('ctb').appendTo($div);
}).addClass('sto').appendTo($div);
var cnt = 0,
$currentTarget;
$('#AddCardBtn').click(function () {
var $newDiv = $div.clone(true);
cnt++;
$newDiv.prop("id", "div" + cnt);
$('#userAddedCard').append($newDiv);
// alert($('#userAddedCard').find("div.sortable-div").length);
});
// Double click to open Modal Dialog Window
$('#userAddedCard').dblclick(function (e) {
$currentTarget = $(e.target);
$('#modalDialog').dialog({
modal: true,
height: 600,
width: 500,
position: 'center'
});
return false;
});
$("#datepicker").datepicker({
showWeek: true,
firstDay: 1
});
$("#Getbtn").on("click", function () {
var val = $("#customTextBox").val();
$currentTarget.find(".ctb").val(val);
$currentTarget.find(".date").val($("#datepicker").val());
$('#modalDialog').dialog("close");
});
});