找不到目标DOM元素?

时间:2018-12-28 06:41:52

标签: javascript timekit

我正在通过中使用TimeKit.io,但日历不会显示?

代码如下:

HTML:

    <div id="bookingjs"></div>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" defer></script>
    <script src="https://cdn.timekit.io/booking-js/v2/booking.min.js" defer></script>

JS(在窗口加载时调用并通过控制台消息验证):

     function yourfunction() {
console.log("yourFunction called to setup timekit.io");
  window.timekitBookingConfig = {
            app_key: 'test_widget_key_rVo9n2x1Js1J7OIh16',
            project_id: '19e3d150-5fc16802ac7',
            autoload: true,
            el: 'bookingjs',
            debug: true,
            availability: {
               mode: 'roundrobin_random',
               length: '4 hours',
               from: '-1 hour',
               to: '8 weeks',
               ignore_all_day_events: false
            },
            reminders: [
              {
                type: 'jn@getme.com',
                settings: { 
                  recipient: 'owner', 
                  subject: 'Scheduled Delivery firing in 80 min or less'
                },
                when: {
                  type: 'before', 
                  unit: 'mins', 
                  time: 80
                }
              }
            ],
            customer_fields: {
                name: {
                  title: 'Full name',
                  prefilled: 'Scheduling System',
                  readonly: true
                },
                email: {
                  title: 'E-mail',
                  prefilled: 'info@getme.com',
                  readonly: true
                },
                comment: {
                  title: 'Comment',
                  prefilled: false,
                  required: true,
                  readonly: false,
                  format: 'textarea'
                },
                phone: {
                  title: 'End Customer Mobile Number',
                  prefilled: false,
                  required: false,
                  readonly: false,
                  format: 'tel'
                }
              },
              callbacks: {
                createBookingSuccessful:     function(response) {},
                createBookingFailed:         function(response) {},
                submitBookingForm:           function(values) {},
                errorTriggered:              function(message) {}
              }
          }
          console.log("Timiekit done setting up");
  }

1 个答案:

答案 0 :(得分:1)

通过ID而不是标签名称作为目标。

el: '#bookingjs'