-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
36 lines (33 loc) · 1.29 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Remove Line Breaks</title>
</head>
<body>
<h1>Remove Line Breaks from Text</h1>
<textarea id="inputText" rows="10" cols="50" placeholder="Paste your text here..." onclick="this.select()"></textarea><br>
<button onclick="removeLineBreaks()">Remove Line Breaks</button>
<button onclick="resetText()">Reset</button><br>
<h2>Processed Text:</h2>
<textarea id="outputText" rows="10" cols="50" onclick="this.select()"></textarea><br>
<button onclick="copyToClipboard()">Copy to Clipboard</button>
<script>
function removeLineBreaks() {
var inputText = document.getElementById("inputText").value;
var newText = inputText.replace(/(\r\n|\n|\r)/gm," ");
newText = newText.replace(/\s+/g, " ");
document.getElementById("outputText").value = newText;
}
function resetText() {
document.getElementById("inputText").value = "";
}
function copyToClipboard() {
var outputText = document.getElementById("outputText");
outputText.select();
document.execCommand("copy");
}
</script>
</body>
</html>