Hi... i'm new in using Joget \:)
Yesterday I've tried to create a form with the addition of the Custom HTML. I use the Custom HTML to initialize the input date. But the code I made does not give any effect (input date field is not filled by the system date), but the alert show me the system date. The following is the code that I enter into the custom HTML :
{code}<script language="JavaScript" type="text/javascript">
$(function() {
$('document').ready(function() {
var currentTime = new Date();
var month = new Array(12);
month[0]="Jan";
month[1]="Feb";
month[2]="Mar";
month[3]="Apr";
month[4]="May";
month[5]="Jun";
month[6]="Jul";
month[7]="Aug";
month[8]="Sep";
month[9]="Oct";
month[10]="Nov";
month[11]="Dec";
var monthName = month[currentTime.getMonth()];
var day = currentTime.getDate();
var year = currentTime.getFullYear();
$("input[name=inputDate]").attr("value",day+'-'+monthName+'-'+year);
alert($("input[name=inputDate]").val());
});
});
</script>{code}
Any suggestion how to initialize some input field?
<script language="JavaScript" type="text/javascript">
$(function() {
$('document').ready(function() {
var currentTime = new Date();
var month = new Array(12);
month\[0\]="Jan";
month\[1\]="Feb";
month\[2\]="Mar";
month\[3\]="Apr";
month\[4\]="May";
month\[5\]="Jun";
month\[6\]="Jul";
month\[7\]="Aug";
month\[8\]="Sep";
month\[9\]="Oct";
month\[10\]="Nov";
month\[11\]="Dec";
var monthname = month\[currentTime.getMonth()\];
var day = currentTime.getDate();
var year = currentTime.getFullYear();
$("input\[name=tanggalCMH\]").attr("value",day+'-'+monthname+'-'+year);
alert($("input\[name=tanggalCMH\]").val());
//alert($("textarea\[name=komentarCMH\]").val());
$("textarea\[name=komentarCMH\]").css("display","none");
$("textarea\[name=komentarCMH\]").val("coba ajah,.. ini asli dari jquery loh");
//alert($("textarea\[name=komentarCMH\]").val());
//$("textarea\[name=komentarCMH\]").css("display","block");
});
});
</script> |