Set Default value for Year column on your NewForm.aspx using Jquery

Sometimes when adding an item to your list or library you may want some of the metadata have default value selected. Today I am going to provide a quick tip on how you can set your Year column (textbox or dropdown) defaulted to current year value using Jquery.

<script language=”javascript” type=”text/javascript” 

src=”/Style Library/jquery-1.9.0.min.js”></script>

    <script language=”javascript” type=”text/javascript”>
    $(document).ready(function() {
     
    var currentYear = (new Date).getFullYear();

    // For Textbox  (change title value to your column title)
   
    $(“input[Title=’Year’]”).val(currentYear);
   
    // For dropdown(change title value to your column title)
   
    $(“select[Title=’Year’]”).val(currentYear).attr(“selected”, “selected”);
     
    });
</script>