How to pass JavaScript function to the INPUT HTML tag -
this want.
<form> <input type="text" name="date" value="currentdate()"> .....</form>
here want set default value current date.
i don't think can that.
but work:
var today = new date(); var dd = today.getdate(); var mm = today.getmonth()+1; //january 0! var yyyy = today.getfullyear(); if(dd<10) { dd='0'+dd } if(mm<10) { mm='0'+mm } today = mm+'/'+dd+'/'+yyyy; document.getelementbyid('date').value=today ;
<form> <input type="text" name="date" id="date"> </form>
i got solution samuel's answer in this post.
Comments
Post a Comment