0
我想創建一個使用jquery ui datepicker的表單。
一切都很完美,只不過因爲我改變了輸入字段的設計,所以在選取日期時不會刪除佔位符屬性。
這裏是小提琴:https://jsfiddle.net/deqguphb/
HTML
Jquery UI日期選擇器不重點輸入
<form>
<ol>
<li>
<input id="input1" name="input1" value="" placeholder="Input1: Working just fine"/>
<label for="input1">Input1</label>
</li>
<li>
<input id="input2" name="input2" value="" placeholder="Input2: The placeholder stays" />
<label for="input2">Input2</label>
</li>
<li>
<input id="input3" name="input2" value="" placeholder="Input3: The placeholder stays" />
<label for="input3">Input3</label>
</li>
</ol>
</form>
的Javascript
/* The focus effect */
$("input:not([value]),input[value='']").addClass('empty');
/* Input event handling */
$('input').on('input keyup', function() {
$(this).toggleClass('empty', !Boolean($(this).val()));
});
我不知道是什麼事件的日期拾取後觸發。我嘗試了onKeyup和onChange,但這並沒有解決問題。
我會爲此感到高興的解決方案。
謝謝你的回答!不幸的是,我沒有解決問題。挑選日期後,標籤仍然在日期的下方。 – Schwesi 2015-03-31 09:30:09