Skip to content
Loading
  • 0
    hi Laxmidhar Sahoo,
     
    $("input# address ") .css('background-color', 'red');
     
    it has no input attribute tag within form. is it working in jquery?
    0
  • Gajendra Jangid
    0
    hello sonal,
     
    try following links will help you:
     
    https://www.c-sharpcorner.com/article/asp-net-mvc5-jquery-form-validator/
    https://www.aspsnippets.com/Articles/Model-validation-using-jQuery-in-ASPNet-MVC-Razor.aspx 
    0
  • Amit Kumar
    0
    Hi,
        You can do it very easily. First create a class then then use it on those cotrols which you want to validate.
     
    For example. 
    1. .redError{  
    2.         border:1px solid green;  
    3.     }  

     use this class on controls when validation is false like this. 
    1. $("#tblAddressDetails").addClass('redError');  
     if validation is true then use like this.
    1. $("#tblAddressDetails").removeClass('redError');    
     full code like. 
    1. if($("#tblAddressDetails").val() == null || $("#tblAddressDetails").val() == "")  
    2. {  
    3. $("#tblAddressDetails").addClass('redError');  
    4. return false;
    5. }  
    6. else{  
    7. $("#tblAddressDetails").removeClass('redError');  
    8. }  
     I hope it will help you.
    0