1

I have a select list that is created on a .click event. It looks like this:

$('<select class="selectStatus" onChange="statusSubmit()"/>')
    .attr('name', 'status')
    .append('<option>Pick one</option>', '<option>Open</option>', '<option>Full</option>', '<option>Canceled</option>')
    .appendTo(this);

In my main styles.css file I added this:

select .selectStatus {
    width:700px;
    padding:0px;
    background-color: green;
}

Shouldn't the css be applied to this select list once it's created?

2
  • use Chrome's inspector to right click and inspect element method to see if the CSS is acting on the <select> typically you can find issues with typos or spaces. Commented Sep 12, 2012 at 0:25
  • I tried that and saw it wasn't being applied. I thought it was some type of issue with the DOM or something. Stupid typos! :) Commented Sep 12, 2012 at 0:26

1 Answer 1

8

You are applying those styles to children of selects with class="selectStatus".

Remove the space: select.selectStatus.

Sign up to request clarification or add additional context in comments.

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.