copy to other input checkbox

by magizter

HTML

<form>
        <input type="text" name="startdate" id="startdate" value=""/>
        <input type="text" name="enddate" id="enddate" value=""/>
        <input type="checkbox" name="checker" id="checker" />
    </form>

CSS

.element{
    height:100px;
    width:120px;
    background-color:#eee;
    display:inline-block;
}
.highlight{
    background-color: yellow
}

JavaScript

$(document).ready(function(){
            $("input#checker").bind("click",function(o){
                if($("input#checker:checked").length){
                    $("#enddate").val($("#startdate").val());
                }else{
                    $("#enddate").val("");
                }
            });
        }
    );