在字段中输入文本时更改提交按钮的颜色



有没有办法在输入文本时更改提交按钮的颜色?不知道这是否可以不使用JavaScript(不是一个非常熟练的编码人员!

.CSS:

#a { 
padding: 1px 3px 0px; 
background: transparent; 
border: 0; 
outline: 0; 
border-bottom: 0.8px solid #D3D3D3; 
width: 300px;
height: 32px;
}
.bttn {
background-color: #FF0783;
border: none;
color: #ffffff;
text-align: center;
text-decoration: none;
font-size: 24px;
width: 216px;
height: 48px;
border-radius: 38px;
text-transform: none;
}

.HTML:

<div style="text-align: center;"><input type="text" id="a" style="text-transform:uppercase; font-family: open-sans, sans-serif; font-style: normal; font-weight: 300; color: black; font-size: 24px; text-align: left;" maxlength="8" autofocus></div>
<div class="sbmt">
<button type="submit" class="bttn">Continue</button>
</div>

不,这不可能通过CSS实现。CSS 没有值的(伪(选择器。可能与此重复。

你可以使用 js 来更改提交类,也可以使用 jquery 来。很简单:$('#id').removeClass('class'); $('#id').addClass('class');

最新更新