I'm adding jquery mobile date picker but it shows the date picker by default. Instead, I want it to show up only on focus and to be hidden when the field loses focus...Any idea how ?
In the page header I added
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<link rel="stylesheet" href="/css/jquery.ui.datepicker.mobile.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script>
//reset type=date inputs to text
$( document ).bind( "mobileinit", function(){
$.mobile.page.prototype.options.degradeInputs.date = true;
});
</script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script src="/js/jQuery.ui.datepicker.js"></script>
<script src="/js/jquery.ui.datepicker.mobile.js"></script>
and a date field in the body to make it work:
<label for="date">Date Input:</label>
<input type="date" name="date" id="date" value="" />
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…