开发者

Jquery Load() Content into dialog()

开发者 https://www.devze.com 2023-02-07 05:16 出处:网络
When i click on element id #itest, I want to load a form with id #form from file modal.html into a jquery U开发者_如何学PythonI dialog() box. How can i do this. Should i have an empty div #result to l

When i click on element id #itest, I want to load a form with id #form from file modal.html into a jquery U开发者_如何学PythonI dialog() box. How can i do this. Should i have an empty div #result to load content in first.


Here is a barebones example of what you are trying to do:

var $div = $("<div/>");
$("#itest").click(function() {
    $div.load('modal.html #form', function() {

       // apply the dialog once the div has been filled up
       $div.dialog(); 
    });
});

You can create a div on the fly or use one which exists on the page, and populate it with the form from modal.html using $.load. To return a particular subset of a page, just put the selector after the URL (as in the above example).

0

精彩评论

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