I have 2 html input fields, one in disabled and gets value from a php file using jQuery ajax and the other one is filled by the user.
I made a jQuery script which compares these two fields and should show a message if the user input is greater than the ajax filled input. The problem is that it returns a strange result, for example if the ajax field is 12300 and the input field is 8 it shows the message, but if ajax is 12300 and the input is 12229 than it does not show the message.
$(document).ready(function(){
$("#cantitate").blur(function(){
var cant_ins = $("#cantitate").val();
var cant_suger = $("#info_cantitate").val();
if (cant_ins > cant_suger){
$("#status_cant").text("Cantitatea depaseste disponibilitatea");
}
else
{
$("#status_cant").empty();
}
});
});
.val()from a input will return a string, not a number