Skip to content

Instantly share code, notes, and snippets.

@xkrsz
Created April 7, 2016 07:13
Show Gist options
  • Save xkrsz/404d85417a963115ecdf91c482eeef77 to your computer and use it in GitHub Desktop.
Save xkrsz/404d85417a963115ecdf91c482eeef77 to your computer and use it in GitHub Desktop.
z3
$(document).ready ->
nf = $('#n')
snf = $('#sn')
pwf = $('#pw')
cpwf = $('#cpw')
$('#pw').keyup ->
$('#pc').text pwf.val().length
if pwf.val().length < 6
pwf.css 'background-color', 'red'
else
pwf.css 'background-color', 'green'
$('#cpw').keyup ->
$('#cpc').text cpwf.val().length
if cpwf.val().length < 6
cpwf.css 'background-color', 'red'
else
cpwf.css 'background-color', 'green'
$('#submit').on 'click', ->
n = nf.val()
sn = snf.val()
pw = pwf.val()
cpw = cpwf.val()
if !n || !sn || !pw || !cpw
alert 'Niektóre pola są puste.'
else if pw.length < 6
alert 'Podane hasło jest za krótkie.'
else if pw != cpw
alert 'Hasła nie są takie same.'
else
alert 'Git.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment