I have this below code where i am trying to alert the date selected on click of an image. I am getting the alert but the issue is date format.
Below is alert i am getting. I need the alert in mm/dd/yyy
Below is the javascript code -
<script>
var count = 0;
function myFunction() {
var a = document.getElementById("page:j_id1:myPicker1").value;
var a1 = document.getElementById("page:j_id1:myPicker2").value;
var str = "";
count++;
str+="<div class='label' date1='"+a+"' date2='"+a1+"'>"+count +". Date 1 "+a;
str+="Date 2 "+a1;
str+="<a href='#' onclick='fnUpdateDate(\'"+a+"\',\'"+a1+"\')'>";
str+="<img src='https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQlvCNq-gyHx63VKBLy1H-lHnqRar0jKJqkoCP9giVm5y76NVY-jg' width='48' height='48'/>";
str+="</a>";
str+="</div>";
$("#resultContainer").append(str);
}
function fnUpdateDate(date1,date2){
alert(date1+" ss "+ date2);
}
</script>
<div class="label" date1="10/4/2016" date2="10/12/2016">1. Date 1 10/4/2016Date 2 10/12/2016<a href="#" onclick="fnUpdateDate(10/4/2016,10/12/2016)"><img src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQlvCNq-gyHx63VKBLy1H-lHnqRar0jKJqkoCP9giVm5y76NVY-jg" width="48" height="48"></a></div>
Regards