【问题标题】:Chrome extension and HTML5 datetime-local inputChrome 扩展和 HTML5 日期时间本地输入
【发布时间】:2021-11-08 09:58:51
【问题描述】:

我正在创建一个 chrome 扩展程序,并添加了一个日期时间选择器。每当我选择日期和时间时,它应该在输入 html 字段中显示所选值。但是,在我的情况下它没有显示。

                                <input type="datetime-local" name="" id="date-el">

我使用上面的 html 代码在我的 chrome 扩展 popup.html 上添加日期时间选择器。我还有一个用于数据库的后台服务人员。之后,做了一些随机测试,我发现当我删除后台服务人员时,日期时间选择器工作正常。

Background.js service worker 一直在后台运行。它会阻止日期输入更新吗? chrome 扩展 service worker 和 html5 日期时间输入有关系吗?

【问题讨论】:

    标签: javascript html google-chrome google-chrome-extension datetimepicker


    【解决方案1】:

    你可以试试这段代码吗,也许你需要把它写成form

    <form>
      <h2> Try Clicking Submit</h2>
      <hr />
      
      <label for="via-html">Set with HTML value attribute (Works fine!)</label>
      <br />
      <input id="via-html" type="datetime-local" value="1980-01-01T01:01:01.001"/>
      
      <br />
      <br />
      
      <label for="via-js">Set with JavaScript (Fails Validation!)</label>
      <br />
      <input type="datetime-local" id="via-js"/>
      <hr />
      <input type="submit" />
    </form>
    
    

    【讨论】:

      猜你喜欢
      • 2015-12-17
      • 2017-03-05
      • 1970-01-01
      • 2023-04-09
      • 1970-01-01
      • 2017-11-03
      • 2012-12-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多