I'm new to create wordpress widget,I want to create a widget which will upload an image and display it on the site's front page,for the sake of that thing i'm writing following code but javascript is not running properly in my code,following code is written in class WP_My_Widget and in file default-widgets.php,actually code of javascript is not running when I try to alert the count of loaded files it simply show me 0.
public function form( $instance ) {
// outputs the options form on admin
?>
<br/>
Please Enter The URL of Leading Site: <input type='text' name='url' id='url'/><br/>
Upload new image: <input type='file' name='images' id='images'><br/>
<br/><a href='javascript:void(0);' id='myid' onclick='abc();'>Proceed Uploaded File!</a>
<script>
function abc(myurl){
myLocalFiles = document.getElementById('images');
len = myLocalFiles.files.length;
alert(len);
}
</script>
<?php
}