mercredi 11 février 2015

Show file directory inside input field


I'm using jQuery based file listing


Code :



<script type="text/javascript">
$(document).ready( function() {
$('#fileTreeDemo_2').fileTree({
root: '../../',
script: 'connectors/jqueryFileTree.php',
folderEvent: 'click',
expandSpeed: 750,
collapseSpeed: 750,
multiFolder: false
},
function(file){
alert(file);
});
});
</script>

<div id="fileTreeDemo_2"></div>


Results : It shows files list and when i choose file, it trigger function(file) and gives alert alert(file);


Alert


Now the question, What if i want to add input field where the chosen file directory rather than giving me alert alert(file); it show it inside that input field as shown in this image


Input


so i just want to modify function(file){ alert(file); }); to show the content of this alert inside input field that has id="dir" with that code



<input type="text" name="something" id="dir">


~ Thanks





Aucun commentaire:

Enregistrer un commentaire