Rev 3165 | Rev 3167 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
function nouveauChamps(html){var html ='<div>'+'<label for="nom_champs">Nom du champ</label>'+'<input type="text" value="Nom du Champs" id="nom_champs">'+'<label for="type_champ">Type de champ</label>'+'<select name="type_champ" id="type_champ">'+'<option value="text">Champ texte</option>'+'<option value="textarea">Champ rédaction</option>'+'<option value="select">Menu déroulant</option>'+'<option value="checkbox">Cases à cocher</option>'+'<option value="radio">Boutons radio</option>'+'<option value="date">Calendrier</option>'+'<option value="file">Téléchargement</option>'+'<option value="hidden">Caché</option>'+'<option value="button">Bouton</option>'+'</select>'+'<div>';$('#profile-details-fields-section').append(html);}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 variablesvar $fileInput = $( ".input-file" ),$button = $( ".label-file" );// action lorsque la "barre d'espace" ou "Entrée" est pressée$button.on( 'keydown', function( event ) {if ( event.keyCode == 13 || event.keyCode == 32 ) {$fileInput.focus();}});// action lorsque le label est cliqué$button.click(function() {$fileInput.focus();return false;});// affiche un retour visuel dès que input:file change$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() {inputFile()// var $projet = $('#projet');// $projet.on('change', function( event ) {// console.log($projet.val());// $.ajax({// url : 'http://localhost/widget:cel:manager',// type : 'post',// datatype : 'mode=creation&projet='+ $projet.val()// });// });$('#add_fields').on("click", function(){nouveauChamps();});});