jQuery的新功能。jQuery选择器问题
我有以下的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>
而且我需要选择帮助下面的函数
$('#upload_button').click(function() {
//how can I select the file input element (ie. #id_profile_pic) here?
});
感谢。
你是什么意思,说“选择”?关注这个元素?或者打开一个选择文件对话框? – silex 2011-05-25 19:04:58