在文本输入字段时更改提交按钮的颜色[复制]

问题描述 投票:0回答:2

有没有办法在输入文本时更改提交按钮的颜色?不知道如果不使用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>
html css forms form-submit
2个回答
0
投票

不,这不可能通过CSS。 CSS没有值(伪)选择器。 this可能重复。


0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.