开发者

Jquery and IE problem!

when pressing the submit button text doesn't update..No开发者_StackOverflowt even the loading box does appear on IE... in firefox everything works excellent!

    $(".form_edit_review").live('submit', function(e){
    e.preventDefault();
    $submittingForm = $(this);
    loading("Updating...");
    postData = $submittingForm.serialize();
    $.post('/review/update', postData, function(xml){
        closeBoxy();
        var success = $("success", xml).text();
        var message = $("message", xml).text();
        if (success == "false")
        {                
            boxy_alert(message);                            
        } 
        else
        {
            $submittingForm.hide().parents("div.resto_review_bg").find(".review_text").html($submittingForm.find("textarea").val()).show();
        }
    });
});

the html code :

                        <form class="form_edit_review" id="formEditReview_<?php echo $row['review_id']?>" style="display: none;">
                        <textarea name="content" style="border: 1px solid #C2C2C2; padding: 10px; width: 547px; height: 45px;"><?php echo $row['review'];?></textarea>
                        <input type="hidden" value="<?php echo $row['review_id']?>" name="id" />
                        <input type="hidden" value="<?php echo $row['resto_id']?>" name="restoid" />

                        <p style="margin-top: 5px;">
                            <input class="btn_comment btn_update" value="Update" type="submit" />
                            <input class="btn_comment btn_cancel" value="Cancel" type="button" />
                        </p>
                    </form>


From the jQuery documentation on submit:

The JavaScript submit event does not bubble in Internet Explorer. However, scripts that rely on event delegation with the submit event will work consistently across browsers as of jQuery 1.4, which has normalized the event's behavior.

The live method relies on bubbling, so it won't work with jQuery earlier than 1.4. If you use regular binding ($(".form_edit_review").submit(....)) on the form, it should work with all versions.


Problem solved!

live doesn't support submit! i changed live with bind and works excellent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜