-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
51 lines (47 loc) · 1.97 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
<html>
<head>
<title>
Javascript library for Search, Highlight and Replace Text
</title>
<body>
<form method="GET" action="" onsubmit="mySHRT.apply(searchstring.value); return false;">
<fieldset>
<legend>Search,Highlight and Replace Text</legend>
<label>Keywords</label><span><input type="text" size="32" name="searchstring" value="">
<input type="submit" value="Highlight Text">
<input type="button" value="Replace Text" onclick="mySHRT.replace(searchstring.value,'REPLACE_STRING_HERE');"></span>
<input type="button" value="Remove Highlight" onclick="mySHRT.remove();"></span>
</fieldset>
</form>
<h2>SHRT, a javascript plugin for search and highlight and replace text</h2>
Works for all the text in the HTML/DOM its like the browser's Find(Ctrl+F)...
<p>
<a href="#">Just some text in a dummy link<a/>|<a href="#"> another dummy link<a/>
</br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi accumsan nec arcu at porta. Sed vel rhoncus dolor. Etiam sed pretium leo, id eleifend tellus. Suspendisse id felis dui. Nam tempus placerat rhoncus. Nullam elementum vitae turpis a ornare. Mauris non lorem auctor, pharetra velit quis, blandit mauris. Vivamus faucibus augue eget dui hendrerit commodo. Vestibulum euismod bibendum ligula nec laoreet. In hac habitasse platea dictumst. Donec commodo ante ante, vel blandit nunc malesuada nec. Fusce elit libero, posuere ut arcu vitae, varius tincidunt massa.
<p>
For example, if I was searching for "string one", it would match:
<br>
string one
<br>
and also
<br>
string <b>one</b> (Even though the "one" is inside a bold tag!)
<p>
<strong>
The SHRT Source can be found on <a href='https://github.com/mashtullah/Search_Highlight_Replace_Text'>github</a>
</strong>
<p>
<p>
<p>
<strong>BY:</strong>Mashtullah Shavalullah
</strong>
<script type="text/javascript" src="SHRT.js"></script>
<script type="text/javascript">
var mySHRT;
document.addEventListener("DOMContentLoaded", function(e) {
mySHRT = new SHRT();
}, false);
</script>
</body>
</html>