0

What method can be used to acquire the content of form?

A common action on the form is validation to ensure the content the user is entering is in an accepted format. Such as getEelmentById etc. I am new to this kind of language, I wish to get a detailed answer, thanks!

6th Jul 2020, 1:53 AM
Jiang Tenghe
Jiang Tenghe - avatar
5 ответов
0
Jiang Tenghe I think you can do it even without JavaScript HTML5 has some form validation features built-in. If you are validaing an email input, you can set the attribute type to email(type="email") and it only accepts data when it is in an acceptable format, for ex. user@example.com You can do the same with JavaScript. Go through this page, https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation
6th Jul 2020, 2:27 AM
Hanuma Ukkadapu
Hanuma Ukkadapu - avatar
+ 1
use html inbuilt validation tool like type=number/email/date/time/color... max= "5" min="2" minlength =" " maxlength =" " pattern =" " most famous required boolean to make input compulsory
6th Jul 2020, 10:26 AM
Divya Mohan
Divya Mohan - avatar
0
OK,I got it. Thanks!
6th Jul 2020, 6:32 AM
Jiang Tenghe
Jiang Tenghe - avatar
0
if you know regex you can add it in pattern attribute of input tag
6th Jul 2020, 10:21 AM
Divya Mohan
Divya Mohan - avatar
- 1
Use if else statement of Javascript. Dom maniculation can help you to get the value of the inputs
6th Jul 2020, 4:01 AM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar