As suggested in the comments, jQuery will be the choice for you. Add a new JavaScript file to your project and add the following code to it. Make sure to reference it in the page for it to work. You will need a reference to
jquery-1.10.2.min.js
as well.
Using the Id of the control as
inDate
for explanation.
$(document).ready(function() {
$('#inDate').focus(function () {
var inDate = $(this).val();
if (inDate == 'dd/MM/yyyy') {
$(this).val('');
}
});
$('#inDate').blur(function () {
var inDate = $(this).val().trim();
if (inDate == '') {
$(this).val('dd/MM/yyyy');
}
});
});
focus event will be triggered whenever the control with id = inDate gets focus. The blur event will be triggered when it looses focus. Refer the following links for more details.
https://api.jquery.com/focus/[
^]
https://api.jquery.com/blur/[
^]