Z
Z
zakharkang2018-01-20 16:09:48
JavaScript
zakharkang, 2018-01-20 16:09:48

How to encode text with JavaScript, how are parameters encoded when submitting html form?

When sending a regular

html forms
<form accept-charset="UTF-8">
  <input name="text">
  <input type="submit">
</form>
a get parameter appears in the address bar:
?text=мой+текст+в+поле+ввода+%2B+%3D+.
How to encode text in input like this with js without submitting a form?
encodeURI(string), encodeURIComponent(string), escape(string)- these functions encode the text a little differently.
I apologize if I call things not by their proper names. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question