我有一個jQuery日期選擇器的輸入字段。所以當你點擊輸入字段時,它會顯示日曆。我還在:after後插入了日曆Font Awesome圖標。如何讓該部分可點擊並啓動jQuery日曆?我無法使輸入字段的背景透明,因爲我需要它是白色的。如何在輸入字段的末尾點擊fontAwesome圖標
$(function() {
$("#dateOfBirth").datepicker({
numberOfMonths: 2,
dateFormat: 'dd-mm-yy',
maxDate: '0',
minDate: '-18M'
});
});
.addingCalendarIcon:after{
content: "\f073";
color:black;
}
.addingCalendar:after{
position:relative;
right:260px;
top:5px;
float:right;
font-family: FontAwesome;
}
<link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<div>
<label>Date of Birth : </label>
<div>
<span class="addingCalendar addingCalendarIcon">
<input type="search" placeholder="dd-mm-yyyy" name="dateOfBirth" onchange="dateOfBirthCheck();adding28Days();makingSixWeekDate();making40dayDate();" id="dateOfBirth" readonly="true"/>
</span>
</div>
</div>
[jQuery的日期選擇器與FontAwesome按鈕?]的可能的複製(https://stackoverflow.com/questions/24019359/jquery-datepicker-with-fontawesome-button) –