Jquery Show div如果选中单选按钮,则将选择器设置为关闭输入值

Jquery Show div如果选中单选按钮,则将选择器设置为关闭输入值,jquery,Jquery,如果选择了第一个单选按钮“我理解并同意…”,我想显示。按钮。因为这是使用软件构建的,所以我需要选择器基于单选按钮的值。默认情况下,按钮是隐藏的。请帮忙 <style type="text/css"> .button { display: none; } </style> <form> <input type="radio" value="I understand and agree to the rules of the Turning

如果选择了第一个单选按钮“我理解并同意…”,我想显示。按钮。因为这是使用软件构建的,所以我需要选择器基于单选按钮的值。默认情况下,按钮是隐藏的。请帮忙

<style type="text/css">
 .button {
 display: none;
 }
 </style>

 <form>
 <input type="radio"  value="I understand and agree to the rules of the Turning Points Essay Contest (you must agree to proceed with registration)" name="consent"><label>I understand and agree to the rules of the Turning Points Essay Contest (you must agree to proceed with registration)</label>
 <br /> <input type="radio" name="consent" value="No, I do not agree with the rules of the Turning Points Essay Contest"><label>No, I do not understand</label>
 </form>
 <div class="button">button</div>

.按钮{
显示:无;
}
我理解并同意转折点作文比赛的规则(您必须同意继续注册)

不,我不明白 按钮

基本上,将事件附加到所有单选按钮。每次其中一个的值更改时,您都要验证是否选中了第一个。如果是,则显示div,否则隐藏它

基本上,将事件附加到所有单选按钮。每次其中一个的值更改时,您都要验证是否选中了第一个。如果是,则显示div,否则隐藏它。

按钮的显示基于选中输入的值是否包含单词“我理解”

您还可以将输入放入标签中,这样您就可以单击文本和微小的单选按钮:

$('input:radio')。更改(函数(){
$('.button').toggle(/I了解/.test(this.value));
});
。按钮{
显示:无;
边框:1px纯黑;
背景:银;
}

我理解并同意转折点作文比赛的规则(您必须同意继续注册)

不,我不明白 按钮
基于选中输入值是否包含“我理解”字样的按钮显示

您还可以将输入放入标签中,这样您就可以单击文本和微小的单选按钮:

$('input:radio')。更改(函数(){
$('.button').toggle(/I了解/.test(this.value));
});
。按钮{
显示:无;
边框:1px纯黑;
背景:银;
}

我理解并同意转折点作文比赛的规则(您必须同意继续注册)

不,我不明白
按钮
如果将按钮移动到表单中,则可以使用CSS:

。按钮{
显示:无;
}
输入[名称=同意]:选中~input[名称=同意]~.按钮{
显示:块;
}

我理解并同意转折点作文比赛的规则(您必须同意继续注册)

不,我不明白 按钮
如果将按钮移动到表单中,则只需使用CSS即可:

。按钮{
显示:无;
}
输入[名称=同意]:选中~input[名称=同意]~.按钮{
显示:块;
}

我理解并同意转折点作文比赛的规则(您必须同意继续注册)

不,我不明白 按钮
正确的方法是使用属性而不是文本比较:

 <input type="radio" allow="true"  value="I understand and agree to the rules of the Turning Points Essay Contest (you must agree to proceed with registration)" name="consent"><label>I understand and agree to the rules of the Turning Points Essay Contest (you must agree to proceed with registration)</label>
 <br /> <input type="radio" allow="false" name="consent" value="No, I do not agree with the rules of the Turning Points Essay Contest"><label>No, I do not understand</label>
 </form>
 <div class="button">button</div>

$("input:radio").change(function()
{
   $(".button").toggle($(this).attr("allow"));
});
我理解并同意转折点征文比赛的规则(您必须同意继续注册)

不,我不明白 按钮 $(“输入:收音机”).change(函数() { $(“.button”).toggle($(this.attr(“allow”)); });

正确的方法是使用属性而不是文本比较:

 <input type="radio" allow="true"  value="I understand and agree to the rules of the Turning Points Essay Contest (you must agree to proceed with registration)" name="consent"><label>I understand and agree to the rules of the Turning Points Essay Contest (you must agree to proceed with registration)</label>
 <br /> <input type="radio" allow="false" name="consent" value="No, I do not agree with the rules of the Turning Points Essay Contest"><label>No, I do not understand</label>
 </form>
 <div class="button">button</div>

$("input:radio").change(function()
{
   $(".button").toggle($(this).attr("allow"));
});
我理解并同意转折点征文比赛的规则(您必须同意继续注册)

不,我不明白 按钮 $(“输入:收音机”).change(函数() { $(“.button”).toggle($(this.attr(“allow”)); });

首先,我建议您选择一个按钮,使其无论在选择时都可见,但您可以将其上的属性更改为“禁用”。只有通过选择器才能解决这个问题,我认为这是不可能的。你需要一个javascript代码来启用/禁用单选值更改时的按钮。首先,我建议一个按钮无论在选择时都是可见的,但是你可以更改它的属性“disabled”。只有通过选择器才能解决这个问题,我认为这是不可能的。您需要一个javascript代码来启用/禁用单选值更改按钮。我需要选择器基于值中的文本而不是第一个,有没有办法做到这一点?是的,给我一秒钟。编辑以按其值搜索元素。我需要选择器基于值中的文本而不是第一个,有没有办法做到这一点?是的,请给我一秒钟。编辑以按其值搜索元素。软件输出代码,我无法直接编辑HTML。由于软件在整个网站上输出代码的方式,我必须使用文本比较,以防止影响其他页面或步骤。软件输出代码,我不能直接编辑HTML。由于软件在整个网站上输出代码的方式,我必须使用文本比较,以防止影响其他页面或步骤。我不能直接编辑HTML,代码是由软件创建的。这是一个非常奇怪的软件,假设按钮是用来提交表单的,但它在表单本身之外。是的,我不能做任何关于软件如何输出代码的事情,这就是它的工作方式。这就是为什么我必须创建疯狂的变通方法。我不能直接编辑HTML,代码是由软件创建的。这是一个非常奇怪的软件,假设按钮是用来提交表单的,但它在表单本身之外。是的,我不能做任何关于软件如何输出代码的事情,这就是它的工作方式。这就是为什么我必须创造疯狂的工作环境。