Welcome folks today in this tutorial we will be making a text splitter tool made in javascript using split method
. All the source code of application is given below
Live Demo
You can see the live demo of text splitter here
Get Started
In order to get started we need to create the index.html
and copy paste the following code
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 |
!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>Static Template</title> </head> <body> <h1> This is a static template, there is no bundler or bundling involved! </h1> <textarea name="" id="text" placeholder="Enter Text" required cols="20" rows="10" ></textarea> <button id="button">Convert</button> <textarea name="" id="code" placeholder="Ascii Code" cols="20" rows="10" ></textarea> </body> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> $("#button").click(function () { //$("#code").val("") var text = $("#text").val(); var arraya = text.split("-"); for (var i = 0; i < arraya.length; i++) { $("#code").append(arraya[i]); $("#code").append("\n"); } }); </script> </html> |
Screenshot