1
I’m trying to make a script that gets the class . input date and convert the date to en, but I can’t do it, I’d like a help.
$.fn.converteData = function(){
var data = ($(this).val()).split("-");
var dataf = data[2]+data[1]+data[0];
$(this).val(dataf);
$(this).mask("99/99/9999"); //estou usando o plugin maskedinput
}
$(".data").converteData();
<form>
<label for="dt_nasc">Data de nascimento</label>
<input class="data" name="dt_nasc" type="text" value="1966-11-27">
</form>
I wish it was already automatically called for all html inputs with the . data class I get it in 1966-11-27 this script would be to convert 27/11/1966.
Can you put the HTML you have? what format these dates are in and what is the final format you want? (give examples)
– Sergio
Here is working normally.
– Guilherme Portela
Sergio, I added in the question.
– JrJs