开发者

How do I set an attribute inside a Jquery dialog box that I created?

I create a modal dialog box "dialog1". I load the HTML contents into it using $("#dialog1").load("dialog_contents.htm") which contains a form. I OPEN the dialog box.

From inside the page that created the dialog box, how can I set the empty ACTION attr开发者_如何学编程ibute in the FORM tag to "process.php"?


$('#dialog1 form').attr('action', 'process.php');

And probably you need to put this code inside the anonymous function triggered after the remote page has been completely loaded like:

$("#dialog1").load("dialog_contents.htm", function() {
    $('#dialog1 form').attr('action', 'process.php');
});


For the sake of other jQuery newbies like me, I'd just like to clarify that when you open a dialog box, it is part of the same page. jQuery transforms the DIV that you define on the page into a dialog box, ie there is no 'remote' page.' I was confused about this until I read another post on StackOverflow which clarified the process for me.

And thanks again to zerkms for helping me out. It saved me a lot of time in experimentation.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜