Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从Javascript选择器中选择参数?_Javascript_Jquery - Fatal编程技术网

如何从Javascript选择器中选择参数?

如何从Javascript选择器中选择参数?,javascript,jquery,Javascript,Jquery,你好(我是一个完全的JS新手,所以请不要欺负我) 我试图在我的分数变量中传递formID,但我认为我没有正确选择,有人能告诉我我做错了什么吗 编辑:对不起,各位,我累了。我的问题:我无法正确选择我的分数var的值 JS HTML 你的分数 您正在按值选择s 您可能需要输入[name=…您可能需要选中的值: $('input[name="tvshowrating' + formID +'"]:checked').val() 下面是另一个回答您问题的问题: 或 您遇到了什么问题?请提供清楚解释

你好(我是一个完全的JS新手,所以请不要欺负我) 我试图在我的分数变量中传递formID,但我认为我没有正确选择,有人能告诉我我做错了什么吗

编辑:对不起,各位,我累了。我的问题:我无法正确选择我的分数var的值

JS

HTML


你的分数
您正在按值选择
s


您可能需要
输入[name=…

您可能需要选中的值:

$('input[name="tvshowrating' + formID +'"]:checked').val()

下面是另一个回答您问题的问题: 或

您遇到了什么问题?请提供清楚解释您问题的代码。您已经向我们展示了一段JS,它甚至没有右括号。@Ian我想应该是这样。“我是一个完整的JS新手,请不要欺负我”-如果我们不能欺负新手,我们能欺负谁?我不知道,去找html新手吧,他们是一个更容易的目标。名字不需要不同,只要使用“:checked”选择器找到选择的单选按钮最后…不知何故谁读了问题并理解了…+1
    <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>
$('input[name="tvshowrating' + formID +'"]:checked').val()