无法在“click”事件上打开jQuery对话框

时间:2022-09-30 21:04:04

I got a small issue here.

我在这里得到一个小问题。

I have a button in a form (this is not a submit button). I want to click this button, check a value in my form and if this value is empty, open a Dialog bow a previously declare.

我在表单中有一个按钮(这不是提交按钮)。我想单击此按钮,检查表单中的值,如果此值为空,请打开先前声明的对话框。

The issue is : the Dialog element doesn't want to be open.

问题是:Dialog元素不希望打开。

So I ran some tests : - I put the Dialog open outside the click event, it's ok - I put an alert instead of the Dialog open, it's ok too

所以我运行了一些测试: - 我把Dialog打开了click事件,没关系 - 我发出警报而不是打开Dialog,也没关系

So this is my HTML :

这是我的HTML:

<div id="popup_archive" style="display:none">
    Veuillez saisir un temps effectif pour cette tâche avant son archivage.<br />
    <input type="text" id="archive_temps_reel" />
</div>

...

<input type="text" size="50" name="temps_reel" />

...

<input id="btn_archiver" type="button" value="Archiver" class="a_bouton a_bouton_gris" />

And the jQuery one :

和jQuery一个:

$(document).ready(function() {

    // on click btn_archiver
    $("#btn_archiver").click( function () {
        if($('input[name="temps_reel"]').val() == '')
        {
            alert("coco");
            $("#popup_archive").dialog("open");
        }
    });

    // define popup_archive
    $("#popup_archive").dialog({
        autoOpen: false,
        modal: true,
        title: "Archivage"
    });

});

Anyone can help me ? Thank you !

有人可以帮帮我吗?谢谢 !

1 个解决方案

#1


0  

Ok I found the "bug". I uninstalled the jQuerify extension for FireBug, and my popup is ok. Don't know why ... Thanks for your answer, really helps me !

好的我发现了“虫子”。我卸载了FireBug的jQuerify扩展,我的弹出窗口没问题。不知道为什么......谢谢你的回答,真的很有帮助!

#1


0  

Ok I found the "bug". I uninstalled the jQuerify extension for FireBug, and my popup is ok. Don't know why ... Thanks for your answer, really helps me !

好的我发现了“虫子”。我卸载了FireBug的jQuerify扩展,我的弹出窗口没问题。不知道为什么......谢谢你的回答,真的很有帮助!