$('#contact-form').validate({
rules: {
fullname: {
minlength: 4,
required: true
},
username: {
required: true,
email: true
},
password: {
minlength: 8,
required: true
},
confirm_password: {
minlength: 8,
required: true,
equalTo: "#password"
},
mobile: {
minlength: 11,
maxlength: 11,
required: true,
number: true
}
},
highlight: function(element) {
$(element).closest('.control-group').removeClass('success').addClass('error');
},
success: function(element) {
element.text('OK!').addClass('valid')
.closest('.control-group').removeClass('error').addClass('success');
},
errorPlacement: function(error, element) {
error.insertAfter(element.parent());
}
});
$('#contact-form').on('keyup blur', function() {
if ($('#contact-form').valid()) {
$('button.btn').prop('disabled', false);
} else {
$('button.btn').prop('disabled', 'disabled');
}
});
<link rel="stylesheet" target='_blank' href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!-- for checking validation -->
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.0/jquery.validate.min.js"></script>
<body>
<div class="container">
<br>
<br>
<br>
<div class="col-md-3"></div>
<div class="col-md-6">
<form method="POST" class="form-horizontal" id="contact-form">
<div class="control-group">
<div class="controls">
<div class="input-group input-group-lg">
<span class="input-group-addon" id="sizing-addon1"> <span class="glyphicon glyphicon-user" aria-hidden="true"></span></span>
<input type="text" id="fullname" name="fullname" class="form-control" placeholder="Your name">
</div>
</div>
</div>
<p class="help-block"></p>
<br>
<br>
<div class="control-group">
<div class="controls">
<div class="input-group input-group-lg">
<span class="input-group-addon" id="sizing-addon1"> <span class="glyphicon glyphicon-envelope" aria-hidden="true"></span></span>
<input type="email" name="username" id="username-reg" class="form-control" placeholder="Your email address">
</div>
</div>
</div>
<p class="help-block"></p>
<br>
<br>
<div class="control-group">
<div class="controls">
<div class="input-group input-group-lg">
<span class="input-group-addon" id="sizing-addon1"> <span class="glyphicon glyphicon-lock" aria-hidden="true"></span></span>
<input type="password" name="password" id="password" class="form-control" placeholder="Your password">
</div>
</div>
</div>
<p class="help-block"></p>
<br>
<br>
<div class="control-group">
<div class="controls">
<div class="input-group input-group-lg">
<span class="input-group-addon" id="sizing-addon1"> <span class="glyphicon glyphicon-lock" aria-hidden="true"></span></span>
<input type="password" name="confirm_password" id="repass" class="form-control" placeholder="Confirm your Password">
</div>
</div>
</div>
<p class="help-block"></p>
<br>
<br>
<div class="control-group">
<div class="controls">
<div class="input-group input-group-lg">
<span class="input-group-addon" id="sizing-addon1"> <span class="glyphicon glyphicon-phone" aria-hidden="true"></span></span>
<input type="text" name="mobile" id="phone" class="form-control" placeholder="Mobile Number">
</div>
</div>
</div>
<p class="help-block"></p>
<br>
<br>
<div class="control-group">
<button type="submit" id="emailSubmit" disabled="disabled" class="btn btn-danger" data-toggle="tooltip" data-placement="bottom" title="Click me to buy">Submit</button>
</div>
</form>
</div>
<div class="col-md-3"></div>
</div>
</body>
You have to implement CSS for success and error classes to set the text to green eg:
.success{
color:green
}
I have an array of objects that look like this: const myArray = [ { taxonomy: 'Orange', slug: 'value1'}, { taxonomy: 'Orange', slug: 'value2'}, { taxonomy: 'Green', slug: 'value3'}, ] I want ...
I have an array of objects that look like this: const myArray = [ { taxonomy: 'Orange', slug: 'value1'}, { taxonomy: 'Orange', slug: 'value2'}, { taxonomy: 'Green', slug: 'value3'}, ] I want ...
I have a basic, working example of what I want to do, but taking this approach comes with a strange limitation. In templates/group.html, there doesn't appear to be any way to add content above or ...
I have a basic, working example of what I want to do, but taking this approach comes with a strange limitation. In templates/group.html, there doesn't appear to be any way to add content above or ...
I am trying to add a company logo to header of Drawer Navigator, but it displays only screen's title. Here is my code: import React, {Component} from 'react'; import {Platform, StyleSheet, Text, View,...
I am trying to add a company logo to header of Drawer Navigator, but it displays only screen's title. Here is my code: import React, {Component} from 'react'; import {Platform, StyleSheet, Text, View,...
I have an array containing several objects similar to the following: {person: {name: "Steve", id: 1}, role: 1} {person: {name: "Phil", id: 2}, role: 1} {person: {name: "Steve", id: 1}, role: 3} {...
I have an array containing several objects similar to the following: {person: {name: "Steve", id: 1}, role: 1} {person: {name: "Phil", id: 2}, role: 1} {person: {name: "Steve", id: 1}, role: 3} {...