jquery background-color change on focus and blur

后端 未结 5 1767

I have the following problem: I have a form with three text input fields, and I want to change the background-color when one of the fields has focus, and get it set back whe

5条回答
  •  感情败类
    2020-12-29 22:50

    Even easier, just CSS can resolve the problem:

    input[type="text"], input[type="password"], textarea, select { 
        width: 200px;
        border: 1px solid;
        border-color: #C0C0C0 #E4E4E4 #E4E4E4 #C0C0C0;
        background: #FFF;
        padding: 8px 5px;
        font: 16px Arial, Tahoma, Helvetica, sans-serif;
        -moz-box-shadow: 0 0 5px #C0C0C0;
        -moz-border-radius: 5px;
        -webkit-box-shadow: 0 0 5px #C0C0C0;
        -webkit-border-radius: 5px;
        box-shadow: 0 0 5px #C0C0C0;
        border-radius: 5px;
    }
    input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus { 
        border-color: #B6D5F7 #B6D5F7 #B6D5F7 #B6D5F7;
        outline: none;
        -moz-box-shadow: 0 0 10px #B6D5F7;
        -webkit-box-shadow: 0 0 10px #B6D5F7;
        box-shadow: 0 0 10px #B6D5F7;
    }
    

提交回复
热议问题