Search code examples
jqueryformssubmitregistration

Adding textbox shadow without focusing


If any fields in registration form are not filled, then that fields should show a red shadow around the text and disable the submit button until all fields are filled.


Solution

  • Try this in CSS

    .error {
      -moz-box-shadow:    1px 1px 2px 2px #F00;
      -webkit-box-shadow: 1px 1px 2px 2px #F00;
      box-shadow:         1px 1px 2px 2px #F00;
    }
    

    And in Script like

    $('input').removeClass('error');
    if(validation===true)// in case of validation error
    {
       $('#inputId').addClass('error');
       $('#submitId').prop('disabled',true);
    }
    else
    {
        $('#submitId').prop('disabled',false);
    }