-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
73 lines (68 loc) · 2.41 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Alert | by Alaa Badran</title>
<link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="./jsalert.css" />
<script src="//code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></script>
<script src="./jsalert.js"></script>
<script>
// Setting options
alert.options = {
'bootstrap': false
};
$(function (){
$('#jsalert').on('click', function (e){
e.preventDefault();
alert($('#alert_message').val());
});
});
</script>
</head>
<body>
<a href="https://github.com/alaabadran/js-alert"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a>
<div class="container">
<h1>JS Alert</h1>
<div class="row">
<div class="col-md-12">
<p>Welcome to my simple code. This is a functionality to override alert() into a customizable alert() with fancy look.</p>
<p>
<form role="form">
<div class="form-group">
<textarea name="alert_message" id="alert_message" class="form-control" placeholder="Enter your message here, you can use HTML tags."></textarea>
</div>
<div class="form-group">
<button id="jsalert" class="btn btn-primary">Show alert</button>
</div>
</form>
</p>
<p>
Code used above:
<h4>HTML</h4>
<pre>
<div class="form-group">
<button id="jsalert" class="btn btn-primary">Show alert</button>
</div>
</pre>
<h4>Javascript</h4>
<pre>
$('#jsalert').on('click', function (e){
e.preventDefault();
// Getting the message text from Textarea
var msg_text = $('#alert_message').val();
// Run it
alert(msg_text);
});
</pre>
</p>
<p>
<h3>Credits</h3>
<a href="http://www.alaabadran.com/" target="_blank">Alaa Badran</a>
</p>
</div>
</div>
</div>
</body>
</html>