开发者

Jquery dialog close by clicking link

开发者 https://www.devze.com 2023-02-23 12:19 出处:网络
I\'m new to use Jquery ui. I\'d like to create a modal dialog box and close it only when I click on the link or image within 开发者_高级运维the modal box.

I'm new to use Jquery ui. I'd like to create a modal dialog box and close it only when I click on the link or image within 开发者_高级运维the modal box.

I found the way to hide close button,but I don't know how set popup close on click or add image with link inside the box.

Can someone provide me full code to obtain this?


If you look at the documentation ( http://docs.jquery.com/UI/Dialog#methods ) you can see there is a close function. When creating the dialog you can attach a click event to any arbitrary element (a new close link/image/button/anything) that calls the close function on that dialog object:

var my_dialog = $('#my_div').dialog({});//options, etc

$('#my_div .my_close_link').click(function () {
  my_dialog.close();
});
0

精彩评论

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