22,15 → 22,24 |
$('#profile-details-fields-section').append(html); |
} |
|
function inputFileStyle() { |
function enregistrerNouveauChamps() { |
var $typeChamp = $('#type_champ'), |
$valeurNouveauChamp = []; |
$type_champ.change(function() { |
$valeurNouveauChamp = $(this).val(); |
console.log($valeurNouveauChamp); |
}); |
} |
|
|
function inputFile() { |
|
// ajout de la classe JS à HTML |
$('html').addClass('js'); |
|
// initialisation des variables |
var $fileInput = $( ".input-file" ), |
$button = $( ".label-file" ), |
$the_return = $(".file-return"); |
$button = $( ".label-file" ); |
|
// action lorsque la "barre d'espace" ou "Entrée" est pressée |
$button.on( 'keydown', function( event ) { |
40,22 → 49,28 |
}); |
|
// action lorsque le label est cliqué |
$button.on( 'click', function( event ) { |
$fileInput.focus(); |
return false; |
$button.click(function() { |
$fileInput.focus(); |
return false; |
}); |
|
// affiche un retour visuel dès que input:file change |
// ...A voir ok=lus tard |
// $fileInput.on( 'change', function( event ) { |
// file = this.value(); |
// $the_return.html( file ); |
// }); |
$fileInput.change( function(event) { |
var file = event.target.files[0] |
var $theReturn = $('.' + $(this).attr('id')); |
|
$theReturn.text(file.name); |
|
if(file.type.match('image')) { |
var tmppath = URL.createObjectURL(file); |
$theReturn.append('<img src="' + tmppath + '" width="50%">'); |
} |
}); |
} |
|
jQuery(document).ready(function() { |
|
inputFileStyle() |
inputFile() |
|
// var $projet = $('#projet'); |
|