Real time form with js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Real time form with js

How to create validation form using real time javascript with terms 1. at least 6 characters or more 2. containing letters and numbers. if it is met appears checklist, if not red writing. https://code.sololearn.com/W0txNcG2chD0/?ref=app https://code.sololearn.com/W0txNcG2chD0/?ref=app

26th Mar 2018, 6:40 AM
Rian Pratama
Rian Pratama - avatar
5 Answers
+ 2
html: <input type="password" name="password" pattern="[\w\d]{6}" required> css: input[type="password"]:invalid { color:red; } input[type="password"]:invalid + button { display:none; } ... be carreful about the '+' css selector operator: it will target the adjacent sibling element only, so it will only work with your actual example, where <button> follow immediatly the password <input> ^^ https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-pattern https://developer.mozilla.org/en-US/docs/Web/CSS/Adjacent_sibling_selectors
26th Mar 2018, 7:39 AM
visph
visph - avatar
+ 1
I was not seing 'or more' after '6 characters'... Change pattern value to: <input type="password" name="password" pattern="[\w\d]{5}[\w\d]+" required> ... but check link about pattern attribute, and learn about regular expression to be able to understand it ^^
26th Mar 2018, 7:55 AM
visph
visph - avatar
+ 1
Hi Rian Try this site http://html5pattern.com/Passwords
26th Mar 2018, 11:31 AM
Mike Choy
Mike Choy - avatar
0
https://code.sololearn.com/W0txNcG2chD0/?ref=app sorry, I use code. don't work.
26th Mar 2018, 7:49 AM
Rian Pratama
Rian Pratama - avatar
0
if you have Referensi code real time password with javascript, share this. please
26th Mar 2018, 7:50 AM
Rian Pratama
Rian Pratama - avatar