私はこのNUMBERPICKERを持っています。 しかし、ボックス内の数字が選択されるまでsection_roomに表示されることは望ましくありません。それまで私はbackgroudImage(プレースホルダー)を持っていたい。カスタムNumberPicker - 最適化
<div class="section_room">
<select id="persons" type="text" placeholder="" onchange="hideIcon(this);">
<option value="null">1</option>
<option value="null">2</option>
<option value="null">3</option>
<option value="null">4</option>
</select>
</div>
<script>
function hideIcon(self) {
self.style.backgroundImage = 'none';
}
</script>
#persons {
background-image: url(../images/icn_person1_dark.png);
background-size: 40% 80%;
background-repeat: no-repeat;
background-position: center;
}
select {
float:right;
width: 20%;
height: 44px;
color: #858585;
font-size: 0.8725em;
outline: none;
font-family: 'Open Sans', sans-serif;
background: #ffffff;
border-color:darkgrey;
border-style: solid;
border-radius: 2px;
outline: none;
-webkit-appearance: none;
-moz-appearance: none;
text-indent: 1px;
}
select option {
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
何の問題あなたは具体的には、持っていますか?あなたのスクリプトは '
私の問題は、section_roomは常に番号1を持っていて、番号を選択するまではbackgroudImage(プレースホルダ)が必要だということです。 –
@JoãoGuerreiroは以下の答えをチェックします。 –