Ich habe zwei Textfelder. Eins ist von Datum und ein anderes ist Bis Datum. Ich validiere beide Textfelder mit der Nummer. aber meine Anforderung ist, wenn ich von Datum füllen 700 als bisher akzeptieren mehr als 700.
Hier ist mein HTMLVergleichen zweier Textfelder für Integer-Wert in jQuery mit Nummer Validierung
$("#from").keypress(function(e) {
//if the letter is not digit then display error and don't type anything
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
//display error message
$("#errmsg").html("Digits Only").show().fadeOut("slow").css("color", "red");;
return false;
}
});
$("#to").keypress(function(e) {
//if the letter is not digit then display error and don't type anything
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
//display error message
$("#errmsg").html("Digits Only").show().fadeOut("slow").css("color", "red");;
return false;
}
});
$("#searchsubmit").click(function() {
var to = $("#to").val();
var from = $("#from").val();
if (to == "" && from == "") {
//alert('Please Provide Era Value For From And To');
$("#response").html("Please Provide Era Value For From And To").show().fadeOut(3000).css("color", "red");
//window.location();
} else {
var info = 'to=' + to + '&from=' + from; {
if (info) {
//alert(info);
window.location.href = "timeline.php?from=" + from + '&to=' + to;;
} else {
alert('No Data Found');
}
}
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<span class="info"> From </span>
<input class="erainput" name="from" id="from" type="text" placeholder="UP To 700" required />
</span>
<span class="eraform">
<span id="errmsg"></span>
<span class="info"> To </span>
<input class="erainput" name="to" id="to" type="text" placeholder="2000" required />
</span>
<span class="eraform">
<button type="submit" id="searchsubmit" name="submit" class="eraBtn"> Search <i class="fa fa-search"></i> </button>
</span>
Dank
Hallo Sir, Entschuldigung für meine Antwort, wenn ich deine sehe Ich fühlte, dass es einen großen Unterschied zwischen unserer Erfahrung gibt. – Osama