As shown in the picture:
If you do not agree to the agreement and click the button in the lower right corner, you will not be able to release the delegation, and a dialog box will pop up. At the same time, set the button to the disabled attribute. (That is: disable the button)
Then I wrote a click event, and if the agreement is checked, the button will be restored.
Then a problem occurred at this time. How should I determine the event? I don't know how to trigger the second event to change the button to the disabled state.
At this time, I tried to write a click event, which can be triggered by clicking on the parent element of this radio button, that is, clicking on that piece. After triggering, the button in the lower right corner will be changed to clickable.
Then I discovered that after the button was disabled, I had to click it twice!
Later I discovered that if I disagree with the agreement in the first step, and then pop up the box, and then disable the lower right button,
I will make the label of the agreement selected and just click this time Once is enough!
However, in this case, the meaning is wrong. The website cannot click the button in the lower right corner without agreeing to the agreement. However, if the button is clicked, the website itself selects the agreement as agreed. Doesn't this force the user to agree to the agreement? ! So, can anyone help me find a solution? urgent! ! !
Below are pictures and codes:
Starting status:
Status after clicking:
The following is the code:
<p class="form-group">
<p class="checkbox col-xs-offset-2">
<label class="checkbox-inline">
<input type="checkbox">
<span class="text-danger">我已经阅读并同意</span> <a href="javascript:;" class="text-primary" target="_blank">《XXXXXXX隐私保护协议》</a>
</label>
</p>
</p>
<br>
<p class="row">
<input type="submit" class="btn btn-info col-xs-offset-3" value="发布专项委托">
</p>
$('.zWt_release_agree').parent().mouseup(function(){
if($('.zWt_release_agree').attr("checked")){
$('.zWt_release_spec').attr({"disabled":false})
}
})
$('.zWt_release_spec').mouseup(function(){
if(!$('.zWt_release_agree').attr("checked")){
alert('您必须同意《花瓣儿网隐私保护协议》后,才可以发布委托!')
$('.zWt_release_spec').attr({"disabled":true})
$('.zWt_release_agree').attr({"checked":true})
}
})
泻药。
不知这是不是你想要的?
https://jsfiddle.net/wcw5qo44/1/
同上,我看了下代码知道大致是什么意思,但是没听懂你表达的问题...
表达能力不行啊老哥
你这个button的点击事件只需要绑定一个啊,在回调里面判断radio的状态,然后做不同的处理。另外绑定事件干嘛要用mouseup?
$('.zWt_release_agree').parent().mouseup(function()
改成$('.zWt_release_agree').parent().click(function()
就好了,你试下,还有我觉得第二个绑定事件多此一举,要是我做直接默认这个按钮为disabled,然后checkbox绑定click事件,如果选中状态disabled为false,否则为true谢邀.
稍微捋下逻辑~
初始状态,btn是不是默认应该是
disabled
的?勾选后才会点亮啊。勾选事件,表单有没有独立的表单事件可以用?jQ有没有给相关的接口?这个去查手册。
接上条,checked是否需要手动改?
布尔属性是一种固有属性,建议通过
.prop()
设置为false来禁止。能不能简单的描述,你说这么多,看着真的很费劲啊。