Guest User

Untitled

a guest
Feb 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. var datesW=$('#dates').width();
  2. console.log(datesW);
  3. $('#dates.ui-datepicker').attr('style', 'width: '+datesW+'px !important');
  4.  
  5. $("input.hasDatepicker").click(function () {
  6. $("#ui-datepicker-div")
  7. // BTW, min-width is better:
  8. //.css("min-width", $(this).outerWidth() + "px");
  9. .css("width", $(this).outerWidth() + "px");
  10. });
  11.  
  12. $("#dates").datepicker({
  13. beforeShow: function(input, inst) {
  14. setTimeout(function(){
  15. var datesW=$('#dates').width();
  16. console.log(datesW);
  17. $('#dates.ui-datepicker').css('width',datesW+'px');
  18. },0);
  19. }
  20. });
  21.  
  22. .ui-datepicker{
  23. font-size:12px; //Or adjust it if it is still too large or small
  24. }
  25.  
  26. `$('#datepicker').datepicker({
  27. beforeShow: function (input, inst) {
  28. setTimeout(function(){
  29. inst.dpDiv.outerWidth($(input).outerWidth());
  30. },0);
  31. },
  32. })`
Add Comment
Please, Sign In to add comment