2017-01-11 13 views
2

お問い合わせフォーム7 Datepicker Pluginを使用している場合、どのように日付フィールドに画像を追加しますか?私が望む例は、このウェブサイトのJquery Datepickerです。 、私が追加私のページのテーマでお問い合わせフォーム7 - Datepicker

[date* your-date id:datepicker class:required 15/ " "] 

$(document).ready(function(){ 
    $("#datepicker").datepicker({ 
     showOn: "button", 
     buttonImage: "http://jqueryui.com/resources/demos/datepicker/images/calendar.gif", 
     buttonImageOnly: true 
    }); 
}); 

しかし、それはフォーム上やコンソールパネルには、画像が、エラーの下

Uncaught TypeError: $(...).datepicker is not a function 
を持っていない示しています。私はこのコード
+0

datepickerのjirstを追加する必要があります。このdatepickerプロパティを使用できます。 –

+0

は次のようになります: https://code.jquery.com/ui/1.12.1/jquery-ui.js –

+0

これで問題が解決したら、私の答え、乾杯を受け入れることができます。 :) –

答えて

3

おそらく、lib jsを含めるのを忘れていました。例えばjquery.min.jsjquery.ui.jsjquery-ui.css

はコード

$(document).ready(function(){ 
 
$("#datepicker").datepicker({ 
 
     showOn: "button", 
 
     buttonImage: "http://jqueryui.com/resources/demos/datepicker/images/calendar.gif", 
 
     buttonImageOnly: true 
 
    }); 
 
})
<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> 
 
<input type="text" id="datepicker"/>

また、あなたがJsFiddleで見ることができますを参照してください。

関連する問題