Search
 
SCRIPT & CODE EXAMPLE
 

HTML

year picker in html

<label for="start">Start month:</label>

<input type="month" id="start" name="start" min="2018-03" value="2018-05">
Comment

how to add year picker in html

$(function() {
  $('#datepicker').datepicker({
    changeYear: true,
    showButtonPanel: true,
    dateFormat: 'yy',
    onClose: function(dateText, inst) {
      var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
      $(this).datepicker('setDate', new Date(year, 1));
    }
  });

  $("#datepicker").focus(function() {
    $(".ui-datepicker-month").hide();
    $(".ui-datepicker-calendar").hide();
  });

});

//////////
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<p>Date: <input type="text" id="datepicker" /></p>
Comment

year picker in html

<select id="years">
</select>
<script>
  var currentYear= new Date().getFullYear();

  const yearselect = document.getElementById("years");
  for (let year = currentYear; year > currentYear-150; year--)
  {
    let opt = document.createElement("option");
    opt.setAttribute("value", year.toString());
    opt.innerHTML = " "  + year.toString() + " ";
    yearselect.appendChild(opt);
  }
</script>
<!--  to get the year -->
<script>
  var e = document.getElementById("years");
  var selectedYear = e.value;
</script>
Comment

PREVIOUS NEXT
Code Example
Html :: html input type="color" 
Html :: get all html element data using angular 
Html :: bootstrap offcanvas 
Html :: loader 
Html :: default php version ubuntu 20.04 
Html :: dir in html 
Html :: how to start in html 
Html :: . and # in html 
Html :: kotlin fabric 
Html :: how to use h1 tag 
Html :: srcset 
Html :: metal gear 
Html :: html5ap 
Html :: how to add command in html 
Html :: HTML <section Element 
Html :: ng class conditional angular 
Html :: code for dropdown in html 
Html :: django html 3.2.4 background image not working 
Html :: a tag redirect to particular section of another page 
Html :: how to read file over two directory back 
Html :: nonce in script tag 
Html :: navratri 2020 
Html :: <input type="hidden" name="csrfmiddlewaretoken" value="TNNT72Wz6HAqopeqbKM4JbX21iWVhZudluidEACoyvh8DoUcJAPcp0RQaVwmS06m" 
Html :: dk lemon yellow sun html 
Html :: Boot Strap loader 
Html :: how to back up disk partision 
Html :: p5 
Html :: pros/cons of using `.createElement()` and `append()` vs. `.innerHTML`? 
Html :: types of html requests 
Html :: add time bar to website complete code 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =