0

I am trying to make the line number generator tool. When anyone writes some lines in the Textarea and click on "Add Line Number" button, then all lines get sequence number. I have no idea how to do this, just sharing the structure code. Please help, thanks in Advance.

<html>
<body>
<form>

  <textarea autocomplete="off" cols="30" id="TextInput" name="message" rows="25" style="display: block;margin-left: auto;margin-right: auto;width: 70%;"></textarea>
  <br />  

</form>

<input id="AddLineNumber" onclick="myFunction()" style="display: block;margin-left: auto;margin-right: auto;color: black;" type="button" value="Add Line Number!" /><br />

<script>
function myFunction() {

}
</script>

</body>
</html>

1 Answers1

0

this is what you will need and in function we will use jquery so add a link for including jquery.Regards.

<html>

<style>

.expand {
    height: 1em;
    width: 50%;
    padding: 3px;
}

</style>
<body>
<form>

  <textarea class="expand" autocomplete="off" cols="30" id="TextInput" name="message" rows="25" style="display: block;margin-left: auto;margin-right: auto;width: 70%;"></textarea>
  <br />  

</form>

<input id="AddLineNumber" onclick="myFunction()" style="display: block;margin-left: auto;margin-right: auto;color: black;" type="button" value="Add Line Number!" /><br />

<script>
function myFunction() {
    $('textarea.expand').focus(function () {
    $(this).animate({ height: "4em" }, 500);
});
}
</script>
  • You forgot to add the `head` and `body` section.. so your html is not valid at all - you also mention jqeuy but you don't include the related script – B001ᛦ Jul 22 '19 at 09:37
  • mate i just copied your code you put and edited on it so you should add other things you want. – Lord Legolas Jul 22 '19 at 09:49
  • _.. i just copied your code ..._ This is not my code. If you want to answer questions properly then you need to give valid answers to the community - you can [edit](https://stackoverflow.com/posts/57142706/edit) your answer and add the missing informatoin into it – B001ᛦ Jul 22 '19 at 09:50