@Html.RadioButtonFor(m => m.FALL_HISTORY, "N", new { @id = "Fall_HistoryN", @name = "FALL_HISTORY", data_value = "0" })0-無
@Html.RadioButtonFor(m => m.FALL_HISTORY, "Y", new { @id = "Fall_HistoryY", @name = "FALL_HISTORY", data_value = "25" })25-有
這是我兩個按鈕,點選可以取得datavalue的值
可是我卻取不到
開F12是有看到的
<input data-val="true" data-val-required="請點選" data-value="0" id="Fall_HistoryN" name="FALL_HISTORY" type="radio" value="N">
<input data-value="25" id="Fall_HistoryY" name="FALL_HISTORY" type="radio" value="Y">
這是我取值的JQUERY
$(function () {
calculateScore();
}
function getValue(str) {
if (isNaN(str)) return 0;
else return parseInt(str, 10);
}
function calculateScore() {
var s1 = getValue($('input[name="FALL_HISTORY"]:checked').attr('data-value'));
}
alert(s1)