开发者

jQuery dialog capture event

i am quite new to jquery but getting there with the help of forums like this. what is the correct way to use dialog in开发者_JS百科 relation to my code? for example, at the moment i am just alerting the celdiv to the screen but i would like to use dialog to show result. can someone show how to use my alert code to pass to dialog?. thanks

<script type="text/javascript">

function procMe(celDiv,id) {
        $(celDiv).click(function () 

            {
            alert(this.innerHTML + " " + id); 
            }
        )}; 
</script>


For using dialog you should have a container in your html like this:

<div id="dialogbox">Some dummy text here</div>

and write this kind of script:

<script>
function procMe(celDiv,id) {
        $(celDiv).click(function () 

            {
            var me = this;
            $("#dialogbox").html(me.innerHTML + " " + id);
            $("#dialogbox").dialog();        
            }
        )}; 
</script>

This code show up the same content of your alert inside a Jquery UI Dialog instead of the classic alert box

If I missed the point please let us know more details ;)


try using jQuery plugin for showing alerts or confirms.

you can use http://abeautifulsite.net/blog/2008/12/jquery-alert-dialogs/

or

http://tutorialzine.com/2010/12/better-confirm-box-jquery-css3/

i have used both.. and happy with their features.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜