Javascript 语法错误,无法识别的表达式:!签入jQuery选择器
我在jQuery1.7网站中使用了这个脚本Javascript 语法错误,无法识别的表达式:!签入jQuery选择器,javascript,jquery,Javascript,Jquery,我在jQuery1.7网站中使用了这个脚本 $('input:radio[name=article-info]:!checked').parent().parent().removeClass('highlight') 我在引导模板中移动此脚本,但chrome控制台向我报告此错误: 未捕获错误:语法错误,无法识别的表达式:输入:收音机[名称=文章信息]:!检查 引导使用jQuery的更新版本 对于这个版本,我应该使用什么语法 完整代码: // Select input radio button
$('input:radio[name=article-info]:!checked').parent().parent().removeClass('highlight')
我在引导模板中移动此脚本,但chrome控制台向我报告此错误:
未捕获错误:语法错误,无法识别的表达式:输入:收音机[名称=文章信息]:!检查
引导使用jQuery的更新版本
对于这个版本,我应该使用什么语法
完整代码:
// Select input radio button
$('input[type=radio][name=article-info]').change(function() {
$('input:radio[name=article-info]:not(:checked)').parent().parent().removeClass('highlight');
$(this).parent().parent().addClass('highlight');
// Price
$price = $('label[for="'+ $(this).attr('id') +'"] .tr-price').text();
$('#price-total').text($price);
// Url btn
$new_url = $(this).parent().siblings('.format').children().children('input').val();
$('#btn-personalizar').attr("href", $new_url);
});
//Select tr
$(".data-click-tr").click(function(){
$(".data-click-tr").removeClass('highlight')
$(this).addClass('highlight').find('input:radio[name=article-info]').attr('checked', true);
$get_input_id = $(this).find('input:radio[name=article-info]').val();
// Precio
$price = $('label[for="'+ $get_input_id +'"] .tr-price').text();
$('#price-total').text($price);
// Url btn personalizar
$new_url = $(this).find('.format').children().children('input').val();
$('#btn-personalizar').attr("href", $new_url);
});
HTML:
<table id="select-size">
<thead class="size-and-price">
<tr class="header-table">
<th colspan="2">Tamaño</th>
<th class="">Precio</th>
</tr>
</thead>
<tbody>
<tr class="data-click-tr highlight" data-click-tr="1426">
<td class="input">
<input id="1426" type="radio" name="article-info" value="1426" checked="checked">
</td>
<td class="format">
<label for="">720X1080 mm <a href="//localhost:3000/manta-polar-75x100/1426">(ver ficha)</a>
<input class="url-designs" type="hidden" value="//localhost:3000/modelos/manta-polar-75x100/1426">
</label>
</td>
<td class="price">
<label for="1426">
<span class="tr-price"> 39 €</span>
</label>
</td>
</tr>
<tr class="data-click-tr" data-click-tr="6685">
<td class="input">
<input id="6685" type="radio" name="article-info" value="6685">
</td>
<td class="format">
<label for="">950X1400 mm <a href="//localhost:3000/manta-polar-95x140/6685">(ver ficha)</a>
<input class="url-designs" type="hidden" value="//localhost:3000/modelos/manta-polar-95x140/6685">
</label>
</td>
<td class="price">
<label for="6685">
<span class="tr-price"> 49 €</span>
</label>
</td>
</tr>
<tr class="data-click-tr" data-click-tr="710">
<td class="input">
<input id="710" type="radio" name="article-info" value="710">
</td>
<td class="format">
<label for="">1200X1900 mm <a href="//localhost:3000/manta-polar-120x190/710">(ver ficha)</a>
<input class="url-designs" type="hidden" value="//localhost:3000/modelos/manta-polar-120x190/710">
</label>
</td>
<td class="price">
<label for="710">
<span class="tr-price"> 69 €</span>
</label>
</td>
</tr>
<tr class="data-click-tr" data-click-tr="2259">
<td class="input">
<input id="2259" type="radio" name="article-info" value="2259">
</td>
<td class="format">
<label for="">2400X1600 mm <a href="//localhost:3000/manta-polar-160x240-queen/2259">(ver ficha)</a>
<input class="url-designs" type="hidden" value="//localhost:3000/modelos/manta-polar-160x240-queen/2259">
</label>
</td>
<td class="price">
<label for="2259">
<span class="tr-price"> 89 €</span>
</label>
</td>
</tr>
</tbody>
</table>
塔马诺
普里西奥
720X1080毫米
39 €
950X1400毫米
49 €
1200X1900毫米
69 €
2400X1600毫米
89 €
这是一个屏幕截图:
这个
代码>运算符不能在选择器中使用
可以使用选择器反转选择器
$(':radio[name="article-info"]:not(:checked)')...
^^^^^^^^^^^^^^
选择器中的:not(:checked)
部分将选择未选中的单选按钮。选择代码>运算符不能在选择器中使用
可以使用选择器反转选择器
$(':radio[name="article-info"]:not(:checked)')...
^^^^^^^^^^^^^^
选择器中的:not(:checked)
部分将选择未选中的单选按钮。要添加负片控件,必须使用:not()
要添加负片控件,必须使用:not()
Mmm这不会在控制台中报告任何错误,但不会检测未检查的输入…@FunnyFrontend。您可能遗漏了其他内容。@FunnyFrontend问题中的相同代码。再说一遍,一定是其他原因导致了这个问题aaahh,我编辑了两次主帖子,你可以看到//Select tr脚本,这失败了!我接受您的回答,但您能否帮助//选择tr?Mmm这不会在控制台中报告任何错误,但不会检测未检查的输入…@FunnyFrontend。您可能遗漏了其他内容。@FunnyFrontend问题中的相同代码。再说一遍,一定是其他原因导致了这个问题aaahh,我编辑了两次主帖子,你可以看到//Select tr脚本,这失败了!我接受你的回答,但是你能帮我做一下//Select tr吗?这一定行得通,但是.parent().parent().removeClass()
部分可能错了。我不知道你用了什么HTML。这一定有用,但可能是.parent().parent().removeClass()
部分出错了。我不知道你有什么HTML的这个。