Shadow DOM で実装されているのですが、ブラウザのものはスクリプトから触ることができません。
しかし、スタイルはある程度コントロールできるため、次のようなCSSを用意してクラス変更によりスタイル適用中にフォーカスを当てれば可能のようです。
Chrome のバージョンアップにより動作しなくなることも考えられるため注意してお使いください。
CSS
1input.month[type="month"]::-webkit-datetime-edit-year-field {
2 visibility: hidden;
3}
JavaScript
1$('input[type="month"]').addClass('month').focus().removeClass('month');
-- 18:26 追記
JavaScript
1$(document).on('focusin', 'input[type="month"]', function(event) {
2 var target = $(this);
3 if (!target.hasClass('month')) {
4 target.addClass('month');
5 requestAnimationFrame(() => target.removeClass('month'));
6 }
7});
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/31 08:44