function listContents(storagename) {
alert(\"inside function\");
//Clear up the list first
$(\'#results\').html(\"\");
var files = navigator.getDeviceSt
Use event delegation
Event delegation allows us to attach a single event listener, to a parent element, that will fire for all descendants matching a selector, whether those descendants exist now or are added in the future.
For dynamically added elements use static parent to add event to the dynamically added elements.
$('#results').on('click', '#upload', function () {
// Handler here
});
See Doc: on