Monday, July 21, 2014

Validation for minimum and maximum price using Jquery

Introduction: In this article today I will explain how we can validate the minimum and maximum price using Jquery
Validation for minimum and maximum price using Jquery


Add a webform to project and design the page as given below:

<html xmlns="">
<head runat="server">
  <title>Validation For Minimum and maximum Price</title>
    <form id="form1" runat="server">

    <fieldset style="width:45%;height:50px">
    <legend>Validation For Minimum and maximum Price:</legend>
       Minimum price:<asp:TextBox ID="minprice" runat="server"></asp:TextBox>
       Maximum price : <asp:TextBox ID="maxprice" runat="server"></asp:TextBox>
     <script src=""></script>
<script src=""></script>
<script src=""></script>
    $("#minprice, #maxprice").change(function (e) {
        var lil = parseInt($("#minprice").val(), 10);
        var big = parseInt($("#maxprice").val(), 10);     
        if (lil > big) {
            var targ = $(;
            if ("#maxprice")) {
                alert("Maximum price must be greater than Minimum price");
            if ("#minprice")) {
                alert("Minimum price must be less than Maximum price");


Run the project and check

Is this article helpful for you?
If yes post your comment to appreciate my work and fell free to contact me. You can like me on Facebook, Google+, Linkedin and Twitter via hit on Follow us Button and also can get update follow by Email. 

No comments:

Post a Comment