Thanks Mike.

Your post helps me understanding of Javascript.
I found an answer for my question.
> I want to override default parameter of the function to avoid writing similar 
> codes.

I could override default parameters with following codes.
---------------------------------------------------------------------
jQuery.ui.dialog.defaults.modal = true;
jQuery.ui.dialog.defaults.bgiframe = true;
jQuery.ui.dialog.defaults.resizable = true;
jQuery.ui.dialog.defaults.width = 400;
jQuery.ui.dialog.defaults.buttons = {
  "Close": function() {
  $(this).dialog("close");
}};
---------------------------------------------------------------------

I can call following simple call with default parameter which I wrote
above.
---------------------------------------------------------------------
          $('<div title="ERROR"></div>')
          .text(response.error)
          .dialog();
---------------------------------------------------------------------


Mike>
I don't want to write HTML code in the body.
I want to controll dialog box only in javascript code to separater
control(Javascript) and view(HTML).


Thanks.

On Dec 3, 10:48 pm, Mean Mike <[email protected]> wrote:
> your on the right track. what you do is put
> your error div your html like this
>
> <div title="ERROR" id="error"></div>'
>
> then setup your dialog
>
> $(document).ready(function(){
>         $("#error").dialog({
>             autoOpen: false,
>             modal: true,
>             buttons: {
>               "Close": function() {
>                 $(this).dialog("close");
>               }
>         });
>
> });
>
> then elsewhere in your javascript when you want to show the error you
> call
>
>  $("#error").dialog('open');
>
> hth
> Mike
>
> On Dec 2, 9:25 pm, matsubokkuri <[email protected]> wrote:
>
> > Hi.
>
> > First, I apology I'm not sure this question is only for jquery-ui or
> > Javascript matter.
>
> > I'd like to use dialog() function in many pages. The code of
> > Javascript will be following.
> > ----------------------
> >           $('<div title="ERROR"></div>')
> >           .text('Error message')
> >           .dialog({
> >             modal: true,
> >             buttons: {
> >               "Close": function() {
> >                 $(this).dialog("close");
> >               }
> >             }
> >           });
> > ----------------------
>
> > I want to override default parameter of the function to avoid writing
> > similar codes.
> > After overriding the parameter, I think I can call the function with
> > following code.
> > ----------------------
> > $('<div title="ERROR"></div>')
> >   .text('Error message')
> >   .dialog();
> > ----------------------
>
> > Best regards.

--

You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to