how to set date while type ="date".in jquery -
i want set date .i used .val() function not work in android.
<input name="casedate" id="casedate" min="2000-01-01" value="" type="date" class="casedate_h" >
js:
var = new date(); var day = ("0" + now.getdate()).slice(-2); var month = ("0" + (now.getmonth() + 1)).slice(-2); var today = now.getfullyear()+"-"+(month)+"-"+(day) ; var = new date(); var day = ("0" + now.getdate()).slice(-2); var month = ("0" + (now.getmonth() + 1)).slice(-2); var today = now.getfullyear()+"-"+(month)+"-"+(day) ; $('#casedate').val(today); $("#casedate").attr("value", today);
wrap code inside :
$(document).ready(function(){ var = new date(); var day = ("0" + now.getdate()).slice(-2); var month = ("0" + (now.getmonth() + 1)).slice(-2); var today = now.getfullyear()+"-"+(month)+"-"+(day) ; var = new date(); var day = ("0" + now.getdate()).slice(-2); var month = ("0" + (now.getmonth() + 1)).slice(-2); var today = now.getfullyear()+"-"+(month)+"-"+(day) ; $('#casedate').val(today); $("#casedate").attr("value", today); });
ourput
2013-08-26
Comments
Post a Comment