I want the minutes in my input to only show up when the input is focused. Can this be achieved?
Currently, I am using jQuery to display the full time, but I prefer to always have the full time as the value and only show what is necessary.
Another issue is that the cursor doesn't go where you click in the input field, it ends up at the end. This happens at least in Firefox.
Are there any smarter ideas to tackle this? Can it be done just with CSS, like setting the color of the last 3 characters to transparent when not focused?
$('input').on('focus', function(e) {
var full_time = $(this).attr('data-full-time');
$(this).val(full_time);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" data-full-time="12:30" data-short-time="12" value="12" />