我有一個操作,如果鎮靜,它不工作真正在這一行if(score> tot){ 我有兩個數字在這些變量它不檢查真實和總數大於得分但返回假不工作。JQuery>操作不起作用
$(document).ready(function(){
$(".saveMarkList").click(function(event){
var score = $(this).closest('tr').find('input').val();
var total = $(this).closest('tr').find('label').text();
var tot = $.trim(total);
if(score > tot){
return false;
}else if(score == ''){
return false;
}else if(tot == ''){
return false;
}
var row = $(this).closest('tr');
var savebtnTD = $(this).closest('tr').find('span');
var subjectId = $(".suid").prop('id');
var senfId = $(".senfid").prop('id');
var studentId = $(this).closest('tr').find('td').next('td').prop('id');
var assesmentId = $(this).closest('tr').find('select').val();
var url = "<?php echo base_url().'examination/saveMarkList';?>";
$.ajax({
url: url,
data: {'subjectId': subjectId, 'senf_id':senfId, 'studentId': studentId, 'assId': assesmentId, 'score': score},
type: 'post',
success: function(result){
if(result){
//row.css('border', '2px solid green');
savebtnTD.css('border', '2px solid green; color: green;').html('<span>دخیره شد</span>');
}else{
alert(result);
}
},
error: function(){
alert("Some technical problem");
}
});
});
});
你能舉一個總分和總分的例子嗎? – Spokey 2014-10-08 11:50:26
當我把變量提醒它顯示我真實的我的號碼,但在檢查其不工作 – 2014-10-08 11:52:47
*總數大於分數*那麼條件是正確的,分數不會大於總數。你是不是指'if(tot> score){' – Spokey 2014-10-08 11:52:50