找不到目标DOM元素

找不到目标DOM元素

我正在通过使用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: '[email protected]',
                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: '[email protected]',
                  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");
  }

最佳答案

按ID(而不是标签名称)定位。

el: '#bookingjs'

关于javascript - 找不到目标DOM元素?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53954657/

10-11 11:19