Close jqModal dialog without setting jqmClose-tag in class-attribute of an input-button

 ̄綄美尐妖づ 提交于 2019-12-11 10:15:31

问题


I'm using jqModal in my ASP.net MVC 3 project. I have some buttons where I apply CSS-styling on them but I've read that the class attribute of an input element can be used to close jqModal-dialogs.

This is an example of a code where jqModal's jqmClose-function is defined in the class attribute of the input-element:

<input class="jqmClose" type="button" onclick="DeleteItem()" value='Bevestig' />

Is there another way to use the class-attribute for CSS-styling and close the jqModal-dialog without using jqmClose?


回答1:


Use the jqmHide method to close a dialog: $('#my-dialog').jqmHide();

Also, your input has two class attributes.

http://dev.iceburg.net/jquery/jqModal/#how




回答2:


The class you are looking for is closeClass - but this only works with images. When a dialog is shown, elements that have a CSS class of closeClass will close the dialog when clicked.

For instance; If your with your dialog you have put the following html inside:

<img class="closeClass" src="close.gif">

the dialog will close when that*image is clicked*.

You can use:

$(*'your-dialog-box-selector-here'*).jqmHide() 

to close a dialog manually. i.e. if your div's id is "jqmodal" you put $("#jqmodal").jqmHide().

But with the image with the class closeClass above within the div, you don't have to program it manually.

Hope this answers your question.



来源:https://stackoverflow.com/questions/9160386/close-jqmodal-dialog-without-setting-jqmclose-tag-in-class-attribute-of-an-input

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!