我正在尝试在windows.ready
上用JQuery调用一个函数。
我的功能:
$(function() {
$(".select2-selection").on("click",function() {
$(this).closest("tr").find('input[type="radio"]').prop('checked', true);
console.log('great success');
})
});
单击select2-selection
元素时,但粘贴相同的代码(减去第1和5行)时,控制台没有任何作用:
$(".select2-selection").on("click",function() {
$(this).closest("tr").find('input[type="radio"]').prop('checked', true);
在控制台内部,我正在寻找所需的功能,这告诉我该功能未正确调用。
如果HTML有某种帮助:
<tr>
<td><input type="radio" name="list" value="5" onclick="showList('kaytana')"></td>
<td> למשתתפי קייטנה</td><td>
<select id="kaytana" style="width:100%" class="listop js-example-basic-single select2-hidden-accessible" name="select5" data-select2-id="kaytana" tabindex="-1" aria-hidden="true">
<option value="" data-select2-id="8"></option>
<option value="all" data-select2-id="66">לכל משתתפי הקייטנות</option>
</select>
<span class="select2 select2-container select2-container--default select2-container--below select2-container--open select2-container--focus" dir="rtl" data-select2-id="7" style="width: 100%;">
<span class="selection"><span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="true" tabindex="0" aria-labelledby="select2-kaytana-container" aria-owns="select2-kaytana-results"><span class="select2-selection__rendered" id="select2-kaytana-container" role="textbox" aria-readonly="true" title=""></span>
<span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>
</span>
</span>
<span class="dropdown-wrapper" aria-hidden="true"></span>
</span></td>
</tr>