If statement

If statement

I have form input with default value of the product bid price. The input has an id of jsBidPrice.
And there is another input without any value and has and if of minBid.

  1.   <form id="placeBid" action="/add-new-bid/{{$product->id}}" method="Post">
  2.                 {!! csrf_field() !!}
  3. <input type="submit" id="bidSubmit" class="btn btn-success" value="Siūlyti kainą" style="float: right" />
  4.                 <div style="overflow: hidden; padding-right: .5em;">
  5.                     <input type="hidden" value="{{$product->bid_price}}" id="jsBidPrice">
  6.    <input type="number" name="bid" class="minBid form-control" min="{{$product->bid_price}}" onkeyup="this.value = minmax(this.value, 0, 100)" placeholder="min. suma {{$product->bid_price}} €" style="width: 100%;" />
  7. </div>​
  8.   </form>
I want to check if user typed less than jsBidPrice. If it is then just return an alert. It works. But when I inspect field element and delete the "min" attribute from the input when I type 6 the ajax works and sents info to DB and I want to do that it should not work when the minBid is not equal or more then jsBidPrice. This is my if:

  1. $(function(){

  2. $('#placeBid').on('submit',function(e){
  3.     $.ajaxSetup({
  4.         headers: {
  5.             'X-CSRF-Token': $('meta[name="csrf_token"]').attr('content')
  6.         }
  7.     });
  8.     e.preventDefault(e);

  9.         if($("#jsBidPrice").val() <= $(".minBid").val()){

  10.         $.ajax({

  11.         method:"POST",
  12.         url: $("#placeBid").attr("action"),
  13.         data:$(this).serialize(),
  14.         dataType: 'text',
  15.         success: function(data){  
  16.            $('.minBid').val(0);
  17.            $("#bidSubmit").attr("disabled", true);

  18.         },
  19.         error: function(data){
  20.             console.log("request failed");
  21.         }
  22.     })
  23.     }
  24.         else {
  25.             alert('Too low.');
  26.         }
  27.     });
  28. });