简体   繁体   English

点击事件不适用于表单插件

[英]click event not working with form plugin

i am using jquery form plugin to upload the images without page reload but it seems that it is not possible to add a click function.i dont know what im doing wrong? 我正在使用jquery表单插件来上传图像而无需重新加载页面,但似乎无法添加单击功能。我不知道我在做什么错?

code: 码:

$(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);
});
});

NOTE: its not possible for me to have the .post_the_img_sing button within the form 注意:我无法在.post_the_img_sing体内使用.post_the_img_sing按钮


UPDATE: found out that i could use a submit button which is hidden then just add a click event to the div .post_the_img_sing 更新:发现我可以使用一个隐藏的提交按钮,然后将一个click事件添加到div中.post_the_img_sing

Looks fine to me, as far as this code goes... Have you checked the class names? 就这段代码而言,对我来说还不错...您检查过类名了吗? Because in your code you have .post_the_img-sing but then you have written .post_the_img_sing ... 因为在您的代码中您具有.post_the_img-sing但是随后您编写了.post_the_img_sing ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM