JavaScript Validation of input field with icon with success or error color validation input field javascript,validation input field jquery,validation input

$('#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>
Answer:1

You have to implement CSS for success and error classes to set the text to green eg:

.success{
    color:green
}
Answer:2

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 ...

  1. merge objects
  2. merge objects javascript
  3. merge objects blender
  4. merge objects illustrator
  5. merge object viewer
  6. merge objects blender 2.8
  7. merge objects inkscape
  8. merge objects maya

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 ...

  1. nesting view within text
  2. nesting of view within text is not currently supported
  3. nesting of view within text is not supported
  4. nesting of view within text react native

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,...

  1. image navigation header
  2. header image react navigation

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} {...

  1. return objects array
  2. return array objects php
  3. return array objects angular
  4. return objects in array javascript
  5. java return objects array
  6. c# return array objects
  7. return all objects in array
  8. return all objects in array javascript
  9. return objects inside array