点击事件不使用表单插件

时间:2014-03-27 19:10:56

标签: jquery ajax image forms submit

我使用jquery表单插件上传图片而不重新加载页面,但似乎无法添加点击功能。我不知道我做错了什么?

代码:

$(document).ready(function () {
var options = {  
    url:'img_handler.php',
    type:'POST', 
    success:function(data) {
        //all the events are handeled properly
    } 
};  
$(".post_the_img-sing").click(function () {///the probem is over here 
$('#post_image_to_stream-single').ajaxForm(options);
});
});

注意:我无法在表单中使用.post_the_img_sing按钮


更新:发现我可以使用隐藏的提交按钮,然后只需将点击事件添加到div .post_the_img_sing

1 个答案:

答案 0 :(得分:3)

对我来说很好,就这段代码而言......你检查了班级名字吗?因为在您的代码中,您有.post_the_img-sing但是您已经写了.post_the_img_sing ...

相关问题