I had a problem wirh my jquery code.My code work well except the alert part in IF condition.
$('#datepicker').datepicker({ onSelect: function(dateStr) {
var url = 'GetExchangeRate';
var sellingRateValue;
var buyingRateValue;
$('#Duedate').val(dateStr);
$.post(url, { dateToGet: dateStr },
function(data) {
var dr = $('#Dollar').val;
var br = $('#BuyingRate').val;
var sr = $('#SellingRate').val;
if ((dr == null || dr.length < 1) && (br == null || br.length < 1) && (sr == null || sr.length < 1)) {
alert("Please enter the exchage for today.");
$('#Dollar').val('');
$('#BuyingRate').val('');
$('#SellingRate').val('');
return false;
}
else {
$('#Dollar').val(data.DollarRate);
$('#BuyingRate').val(data.SellingRate);
$('#SellingRate').val(data.BuyingRate);
//alert(data.CurrentDate);
}
}, 'json');
}
});
Here is code part which is not working.
if ((dr == null || dr.length < 1) && (br == null || br.length < 1) && (sr == null || sr.length < 1)) {
alert("Please enter the exchage for today.");
$('#Dollar').val('');
$('#BuyingRate').val('');
$('#SellingRate').val('');
return false;