简体   繁体   中英

jQuery UI date picker does not add button to page

I have the following function which I call on dynamically created input elements of type date after wrapping them in $(...) .

function addDatePicker(jQueryObject) {
  jQueryObject.datepicker({
    showOn: "button",
    buttonImage: urlToImage,
    buttonImageOnly: true,
    dateFormat: 'yy-mm-dd',
    changeMonth: true,
    changeYear: true,
    numberOfMonths: 1,
    yearRange: "c-10:c+10",
    showButtonPanel: true
  });
}

I can see, when inspecting the page elements in Chrome, that the class hasDatePicker is correctly added to the input tag. However, the img tag containing the button is not added.

What am I doing wrong? The input tag is inside a td tag. Might that be the reason?

Check your image URL or use img url ( http://jqueryui.com/resources/demos/datepicker/images/calendar.gif )

Check working code on http://jsfiddle.net/cvPCL/

buttonImage: "http://jqueryui.com/resources/demos/datepicker/images/calendar.gif",

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM