最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Date picker in HTMLServiceGoogle Apps Script - Stack Overflow

programmeradmin1浏览0评论

I would like to use a date picker to make easier the way to pick a date in an app that I am developing, however I dont know how to make it functional using HTML Service in Google Apps Script.

If you could provide me an example of this, I would really appreciate it since I really need it

I would like something like this: /

I would like to use a date picker to make easier the way to pick a date in an app that I am developing, however I dont know how to make it functional using HTML Service in Google Apps Script.

If you could provide me an example of this, I would really appreciate it since I really need it

I would like something like this: http://jqueryui./datepicker/

Share Improve this question edited Feb 6, 2019 at 15:05 Wicket 38.5k9 gold badges78 silver badges193 bronze badges asked Mar 2, 2014 at 3:08 Javier RamirezJavier Ramirez 871 gold badge1 silver badge7 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

You just need to include the JQuery library in your code, a basic example is as follows :

<div class="demo" >
<style type="text/css"> .demo { margin: 30px ; color : #AAA ; font-family : arial sans-serif ;font-size : 10pt } 
                            p { color : red ; font-size : 14pt } 
</style>
<link rel="stylesheet" href="//ajax.googleapis./ajax/libs/jqueryui/1.9.1/themes/cupertino/jquery-ui.css">

<script src="//ajax.googleapis./ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//ajax.googleapis./ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>

<h1>Wele to some random page</h1>

<p>Please select a date below :</p>

click here : <input type="text" name="date" id="datepicker" />
<input type="text" id="alternate" size="30"></p>
<script>
    $( "#datepicker" ).datepicker({
      altField: "#alternate",
      altFormat: "DD, d MM, yy",
      showWeek: true,
      firstDay: 1,
     });
</script>

</div>

Code.gs :

function doGet() {
  return HtmlService.createTemplateFromFile('index').evaluate().setSandboxMode(HtmlService.SandboxMode.NATIVE);
}

Note the it is advised to separate style from html and script in different files, see the best practice article in Google HTML Service documentation, I didn't do it here to make the example short and easier to read.

发布评论

评论列表(0)

  1. 暂无评论