# ユーザーカスタムフィールド内の Datepicker

**URL:** <https://meta.discourse.org/t/datepicker-in-a-user-custom-field/83550>\
**Category:** Development\
**Tags:** user-custom-fields\
**Created:** [2018 年 3 月 22 日午後 12:42 UTC](https://meta.discourse.org/t/datepicker-in-a-user-custom-field/83550 "2018-03-22T12:42:55Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Vaping\_Community](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vaping_community/32/89248_2.png) [@Vaping\_Community](https://meta.discourse.org/u/Vaping_Community)\
**Post date:** [2018 年 3 月 22 日午後 2:13 UTC](https://meta.discourse.org/t/datepicker-in-a-user-custom-field/83550/4 "2018-03-22T14:13:57Z")

</div>

I got what I wanted to work using this:

A jQuery date picker in the user field input.

```plaintext
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">

<script type="text/discourse-plugin" version="0.8">
$( document ).ajaxComplete(function() {
    api.onPageChange(() =>{
	$( function() {
		var control = $("label:contains('Quit Smoking Date')").next('div.controls');
		$(control).find('input').addClass('quitDate');
		$( ".quitDate" ).datepicker();
	});
    });
});
</script>

```

It would be nice to be able to detect the profile page URL using this but I couldn’t get it to work

```plaintext
api.onPageChange((url) => {
        if (url === '/' || url === '/latest' || url === '/top') {

```

 ![quit-date-calendar](https://global.discourse-cdn.com/meta/original/3X/b/e/bef8fb1095247612b3fb47582e0fd58ff5374214.png)

---

_[View the full topic](https://meta.discourse.org/t/datepicker-in-a-user-custom-field/83550)._
