1

Since the old version was apparently way too hard for people to understand, here's the HTML, CSS, and JavaScript combined:

$(document).ready(function() {
  $('#test').dialog({
    autoOpen: false,
    modal: true
  });
  $("#test-link").click(function() {
    $('#test').dialog('open');
  });
});
div#main div#test label {
  display: block;
}

div#main div#test input {
  padding-left: 100px;
}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>

<div id="main">
  <p><a href="#" id="test-link">test</a>
    <p>
      <div id="test" title="Submit Bug or Feature Request">
        <form>
          <label for="test_desc">Short Description:</label>
          <input type="text" name="test_desc" id="test_desc" value="" />
          <input type="submit" name="" value="Submit" />
        </form>
      </div>

</div>

The dialog works fine, but the CSS does not. Any ideas why?

0

2 Answers 2

1

JQuery moves a dialog's DIV in the DOM tree and wraps it in some others. Therefore the CSS selectors won't work. Using the above example you'd have to do something like this:

div.ui-dialog div#test label {
    display: block;
}
div.ui-dialog div#test input {
    padding-left: 100px;
}
Sign up to request clarification or add additional context in comments.

Comments

0

The css should work. It might be a problem with how the css rules cascade. Is there a more specific selector applying these rules like "#dialog div#test label"? Without the rest of html/css it's impossible to point out the specifics. Get firebug and see what rules are getting applied to those elements.

1 Comment

Not sure why I got voted down here. The original question had incomplete information. It was a good guess based on the original info

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.