javascript - 关于如何禁用文本字段而不影响其他人的 Jquery 单选按钮
问题描述
我需要帮助。我在 jquery 中有一个问题,当您单击单选按钮时,它不应该受到其他人的影响。
这是我的代码:
<script>
jQuery("input[type='radio']").change(function(){
if(jQuery(this).val() == "Not Vote Anyone")
{
jQuery( ".txtfield" ).prop( "disabled", false );
} else {
jQuery( ".txtfield" ).prop( "disabled", true );
}
});
</script>
网站:
解决方案
如果您使用选择器input[type='radio']
,它将影响所有单选按钮。你可以这样尝试:
<script>
jQuery("input[name='radio-743']").change(function(){
if(jQuery(this).val() == "Not Vote Anyone"){
jQuery( ".txtfield" ).prop( "disabled", false );
} else {
jQuery( ".txtfield" ).prop( "disabled", true );
}
});
</script>
推荐阅读
- c - 寻求有关如何跟踪收到的 L2CAP 数据包之间经过的时间的建议
- javascript - 为什么jsfiddle说引用未定义
- awk - 在文件中找到一块负数,改变符号(从负数到正数),并添加一个常数?awk
- java - Intellij Console 不打印外来词
- javascript - 使用 Tone.js 笔记创建音效?
- google-drive-api - gapi.client 的问题
- html - HTML 标签问题
- python - 将 csv 文件加载到 BIGquery 并在插入数据时添加日期列
- regex - Apache Substitute 不适用于特殊字符
- c# - Selenium 文件从 URL 上传而不是本地文件