HTML
xxxxxxxxxx
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8" />
5
<title></title>
6
<!-- Font Awesome -->
7
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
8
rel="stylesheet" />
9
<!-- Google Fonts -->
10
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
11
rel="stylesheet" />
12
<!-- MDB -->
13
<link href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/6.1.0/mdb.min.css"
14
rel="stylesheet" />
15
<script src="https://code.jquery.com/jquery-3.6.3.min.js"
16
integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU="
17
crossorigin="anonymous"></script>
18
<script src="https://www.jsviews.com/download/jsrender.js"></script>
19
20
<script id="tpl_profile2" type="text/x-jsrender">
21
<div style="padding: 20px; ">
22
<div class="form-outline" style="width: 22rem;">
23
<input value="{{:value}}" type="text" id="form11" class="form-control">
24
<label class="form-label" for="form11" style="margin-left: 0px;">{{:title}}</label>
25
<div class="form-notch"><div class="form-notch-leading" style="width: 9px;"></div><div class="form-notch-middle" style="width: 87.2px;"></div><div class="form-notch-trailing"></div></div>
26
</div>
27
</div>
28
</script>
29
</head>
30
<body>
31
32
<div style="padding: 20px; ">
33
<button type="button" class="btn btn-primary" onclick="mybootbox()">
34
Bootbox
35
</button>
36
</div>
37
38
<script>
39
40
function mybootbox() {
41
// var html = $.templates('#tpl_profile2').render({});
42
// let message = document.getElementById('tpl_profile2').innerHTML;
43
let message = $.templates('#tpl_profile2').render({ title: 'Exmple label', value: '123a' });
44
45
bootbox.alert({
46
title: 'title',
47
message: message, callback: function () {
48
console.log('callback');
49
}
50
});
51
}
52
</script>
53
54
<!-- MDB -->
55
<script type="text/javascript"
56
src="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/6.1.0/mdb.min.js"></script>
57
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootbox.js/6.0.0/bootbox.min.js" integrity="sha512-oVbWSv2O4y1UzvExJMHaHcaib4wsBMS5tEP3/YkMP6GmkwRJAa79Jwsv+Y/w7w2Vb/98/Xhvck10LyJweB8Jsw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
58
59
60
</body>
61
</html>
CSS
1
1
JS
xxxxxxxxxx
1
document.addEventListener('show.mdb.modal', () => {
2
document.querySelectorAll('.form-outline').forEach((formOutline) => {
3
new mdb.Input(formOutline).update();
4
});
5
})
6
Console errors: 0