New to jQuery.
I have the following html:
<form enctype="multipart/form-data" action="/upload/" method="post">
<div class="field">
<label for="id_profile_pic">Profile Pic</label>
<input type="file" name="profile_pic" id="id_profile_pic" />
</div>
<div>
<span>Profile Picture</span>
<img src="/site_media/profile_pic/4e17c792-3c34-4556-8c67-135bc931eb5a.jpg"/>
<input type="button" value="Upload" id="upload_button" />
</div>
</form>
And I need help with the selector in the following function
$('#upload_button').click(function() {
//how can I select the file input element (ie. #id_profile_pic) here?
});
Thanks.
You could target that element just as you targeted the first in your initial selector:
Was there something more you were intending to do with this?