我想更改CSS類提交按鈕,兩個單選按鈕之間切換時。我不能找到一個很好的例子,希望有人能幫助我了...單選按鈕啓用/ CSS改變對提交按鈕
這裏是我的形式;
<form class="orderform">
<input type="radio" name="choice" id="out" value="140" checked> <label for="out">I want A</label>
<input type="radio" name="choice" id="in" value="40"> <label for="in">I want B</label>
<input type="submit" value="Save changes" class="submit-btn-disabled" disabled="disabled">
</form>
Disabled(默認)提交按鈕應該像上述(類= 「提交-BTN-禁用」),使能它應該看起來像類= 「提交-BTN」>,與「鼠標懸停」事件:
<input type="submit" value=" Save changes" class="submit-btn">
這裏的css類;
input.submit-btn-disabled{
-webkit-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
border: none;
background-color: #c4daaa;
padding: 0.8em;
font-size: 0.8em;
color: #fff;
cursor: pointer;
margin-top: 1em;
}
input.submit-btn{
-webkit-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
-webkit-border-radius: 0em;
-moz-border-radius: 0em;
border-radius: 0em;
border: none;
background-color: #3A7B30;
padding: 0.8em;
font-size: 0.8em;
color: #fff;
cursor: pointer;
margin-top: 1em;
}
input.submit-btn:hover{
background-color: #82bc00;
}
問題是什麼?你在期待什麼? – Mutant
看看jquery'.toggleClass()':https://api.jquery.com/toggleClass/通過綁定到一個事件 - 比如'mouseover' - 我認爲你應該能夠完成你所要的描述。 – ThomasK