1

At frontend i have to add Date-picker where have to show only Month and Year(not date) with year in range(like 1990 - 2020).

Please suggest me how can i do this?

1 Answer 1

2

I propose you this solution with Bootstrap Datepicker, Demo: JsFiddle

<!--Html part-->
    <div class="input-append date" id="datepicker" data-date="" data-date-format="mm-yyyy"> 
        <input  type="text" readonly="readonly" name="date" >     
        <span class="add-on"><i class="icon-th"></i></span>   
    </div>

<!--Js part-->
<script type="text/javascript">
    $("#datepicker").datepicker( {
    format: "mm-yyyy",
    viewMode: "months", 
    minViewMode: "months"
    });
</script>

More informations in : Bootstrap datepicker doc

Nb: don't forget to include this if you don't have theme:

  • bootstrap-combined.min.css

  • datepicker.css

  • bootstrap.min.js

  • bootstrap-datepicker.js

5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.