Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html lang="en">
- <head>
- <title>Bla Bla Bla</title>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
- <script>
- $(document).ready(function(){
- $('#pencet').on('click', function(){
- var arrText = $('#mytxtarea').val().trim().split('\n');
- var newText = '';
- $.each(arrText, function(i,text) {
- if(text.length < 1 || text == "\r\n" || text == "\n" || text == "\r" || text == "\n\r") {
- return true;
- }
- newText+= text.trim()+'\n';
- });
- alert(newText);
- });
- });
- </script>
- </head>
- <body>
- <center>
- <textarea name="mytxtarea" id="mytxtarea" rows=7 cols=33>This is a sample text</textarea>
- <br>
- <button id=pencet>test</button>
- <center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment