チェックボックスと .val() 関数の理解に根本的な誤りがあります。
<input id="test" type="checkbox" value="ValueToReturnIfChecked" name="WhateverToUseInYourPost" />
$("#test").val() //will return "ValueToReturnIfChecked.
$("#test").is(":checked") //will return true or false.
$("#test").prop("checked") //will return true or false.
$("#test").attr("checked") //will return checked or empty string
編集:追加の説明
私はあなたの実際の質問に答えるべきだと思います。答えは、 *.val() を *.is(":checked") と比較できないということです。これらは根本的に異なります。過去の状態を追跡したい場合は、いつでも行うことができます:
$("#test").on("click", function(){
$this = $(this);
if($this.data("priorState") == $this.is(":checked")){
//Do something
}else{
//The following will inject the state into the checkbox so you can track it.
$this.data("priorState", $this.is(":checked"))
}
});