-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
119 lines (116 loc) · 3.89 KB
/
index.html
File metadata and controls
119 lines (116 loc) · 3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<html>
<head>
<meta charset="UTF-8" />
<meta
name="”description”"
content=" show modal when user selects the option and Passing Textbox Value to
another page via JavaScript | Javascript"
/>
<meta name="keywords" content="HTML, CSS, JavaScript,Jquery,bootstrap" />
<meta name="author" content="Radwan Anik | Radwan Ahmed" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css"
integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn"
crossorigin="anonymous"
/>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<nav>
<a href="index.html" class="btn btn-primary">Home page</a>
<a href="me.html" class="btn btn-primary">another page</a>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12">
<h5>
show modal when user selects the option and Passing Textbox Value to
another page via JavaScript
</h1>
</div>
<div class="col-md-12">
<!-- Trigger modal using -->
<select class="form-control" id="myselect">
<option>select</option>
<option value="one">One</option>
<option value="two">Two</option>
<option value="three">Three</option>
<option value="four">Four</option>
</select>
</div>
</div>
</div>
<!-- Modal -->
<div
class="modal fade"
id="myModal"
tabindex="-1"
role="dialog"
aria-labelledby="myModalLabel"
>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form id="passingForm">
<div class="form-group">
<label for="inputValue">Example</label>
<textarea
class="form-control"
id="inputValue"
rows="3"
></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">
Close
</button>
<button type="submit" id="submitBtn" class="btn btn-primary">
Save
</button>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"
></script>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF"
crossorigin="anonymous"
></script>
<script>
$('#myselect').change(function () {
var opval = $(this).val();
if (opval == opval) {
$('#myModal').modal('show');
}
});
$(document).ready(function () {
const submitBtn = document.querySelector('#submitBtn');
submitBtn.addEventListener('click', function () {
const inputValue = document.querySelector('#inputValue').value;
localStorage.setItem('objectToPass', inputValue);
window.location = 'https://radwan503.github.io/PassingValue--JavaScript/me.html';
});
});
</script>
</body>
</html>