0

I am working with jQuery dialog:

When the dialog opens, Firebug shows...

<div id="dialog" style="width: auto; min-height: 0px; height: 274px;">,

...but I need to set the width to 346px.

  1. I tried using $("#dialog").css({width : '346px'}), but this does not work. After setting the width via .css(), Firebug continues to show width: auto.

  2. I even hard-coded the style attribute as <div id='dialog' style="width:346px">, but this does not work! Firebug continues to show width: auto.

Can someone please tell what is wrong in my code? How should I set the width of this dialog div? Thanks.

3 Answers 3

2

Do it this way:

$("dialog").dialog({
     "modal": true, 
     "width": 346, 
     "height": 400
});
Sign up to request clarification or add additional context in comments.

Comments

1
$("#dialog").dialog({
        width:'346px'
});

Demo - http://jsfiddle.net/75xzH/1/

Comments

0

This must work

$("#dialog").attr('style','width:346px');

This makes sure that your CSS is applied and later this inline style overrides your CSS making the width:346 px; as you want.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.