Last active
August 4, 2018 01:35
-
-
Save gregoryagu/7031cc832f07307adc99b3e626fcd83e to your computer and use it in GitHub Desktop.
Materialize Validation With Char Counter with RC - Does not 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"> | |
<!-- Compiled and minified CSS --> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/css/materialize.min.css"> | |
<!-- Compiled and minified JavaScript --> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/js/materialize.min.js"></script> | |
</head> | |
<body> | |
<div class="row"> | |
<form class="col s12"> | |
<div class="row"> | |
<div class="input-field col s6"> | |
<input id="input_text" type="text" data-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" data-length="120"></textarea> | |
<label for="textarea2">Textarea</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