Last active
August 4, 2018 01:34
-
-
Save gregoryagu/fea7d0db93d0bc50b9c398e8f41240dd to your computer and use it in GitHub Desktop.
Materialize Validation With Char Counter with .97 - Does work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>GistRun</title> | |
<link rel="stylesheet" href="styles.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<script src = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script> | |
<link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css"> | |
</head> | |
<body> | |
<div class="row"> | |
<form class="col s12"> | |
<div class="row"> | |
<div class="input-field col s6"> | |
<input id="input_text" type="text" length="10"> | |
<label for="input_text">Input text</label> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="input-field col s12"> | |
<textarea id="textarea2" class="materialize-textarea" length="120"></textarea> | |
<label for="textarea2">Textarea</label> | |
</div> | |
</div> | |
</form> | |
</div> | |
<div class="row"> | |
<form class="col s12"> | |
<div class="row"> | |
<div class="input-field col s6"> | |
<input id="input_text2" type="text" data-length="10"> | |
<label for="input_text2">Input text using data-length </label> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="input-field col s12"> | |
<textarea id="textarea3" class="materialize-textarea" data-length="120"></textarea> | |
<label for="textarea3">Input text using data-length</label> | |
</div> | |
</div> | |
</form> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( document ).ready(function() { | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$().ready(function () { | |
console.log("init validation"); | |
$("#signUp").validate({ | |
rules: { | |
company: { | |
required: true, | |
minlength: 2 | |
}, | |
agree: { | |
required: true | |
} | |
}, | |
submitHandler: function (form) { // for demo | |
alert('valid form submitted'); // for demo | |
return false; // for demo | |
}, | |
errorClass: 'invalid', | |
errorElement: 'div', | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* todo: add styles */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment