1

I did this JS component but in some pages as codepen it crashes when I click submit because the the button adds a "?#" to the URL (running locally) and is like it changes to another page, this happens the first time I post a message, can be avoided? or is a normal thing of submit?

<div id = "typeSection">
<label for="message">Message:</label>
<form action="#" id="typeForm">
<label for="message"></label>
<textarea id= "character">0/280.</p>
<input type="submit" id = "addButton" value="Submit">

This is the component running in CodePen:

https://codepen.io/LeonAGA/pen/vroRBB

XaelGa
  • 140
  • 2
  • 10

2 Answers2

0
<form action="#" id="typeForm">

Action value might be the reason why adding # after the URL, try assign "" instead of # symbol

Yang Daniel
  • 125
  • 5
0

when you add 'action="#"' in the form tag below:

<form action="#" id="typeForm">

it redirects the page to the current url with a "#" appended on to the end. If you put:

<form action="" id="typeForm">

you shouldn't have to worry about the "#" anymore.

awohlford
  • 9
  • 1