您好(我是一个完整的 JS 新手,所以请不要欺负)我正在尝试在我的 score 变量中传递 formID 但我认为我的选择器没有正确,谁能告诉我我做错了什么?
编辑:对不起大家,我累了。我的问题:我无法正确选择我的 score var 的值。
JS
function addScore(formId) {
var show_id = $('#show_id-'+formId).val();
var user_id = $('#user_id-'+formId).val();
var score = $('input[value="tvshowrating' + formID +'"]').val();
HTML
<form id="40">
<div class="your-score">
<div class="">Your Score</div> <div id="flash"></div>
<input class="hover-star" type="radio" name="tvshowrating40" value="1" title="1" />
<input class="hover-star" type="radio" name="tvshowrating40" value="2" title="2" />
<input class="hover-star" type="radio" name="tvshowrating40" value="3" title="3" />
<input class="hover-star" type="radio" name="tvshowrating40" value="4" title="4" />
<input class="hover-star" type="radio" name="tvshowrating40" value="5" title="5" />
<input class="hover-star" type="radio" name="tvshowrating40" value="6" title="6" />
<input class="hover-star" type="radio" name="tvshowrating40" value="7" title="7" />
<input class="hover-star" type="radio" name="tvshowrating40" value="8" title="8" />
<input class="hover-star" type="radio" name="tvshowrating40" value="9" title="9" />
<input class="hover-star" type="radio" name="tvshowrating40" value="10" title="10" />
<input type="hidden" id="show_id-40" value="40" />
<input type="hidden" id="user_id-40" value="2" />
<span id="hover-test" style="margin:0 0 0 20px;"></span>
<input id="submitscore" type="submit" value="Submit scores!" onclick="addScore(40);" />
</div>
</form>
</div>