3

I downloaded JQuery UI and added the script to my solution, and with a small amount of code, I have a beautiful date picker.

However, I need to use my own theme from my css file. I have created the date picker as per the example code, but it has no style. That is, it appears over existing text. Is there a way I can assign a css style from my existing css file, to make the background of the calendar no be transparent, and use my colours?

2 Answers 2

6

The easiest way is to generate the JQuery UI theme using the ThemeRoller to match your current theme. It's much better than you create it by hand since you will need to match all the CSS namings used by JQuery UI,

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

3 Comments

Thanks @limc - but then how do I assign the them to my Date Picker? I tried a test by creating a CSS class in my CSS file with the same class name used on my textbox (which triggers the Date Picker), but the class is probably only applied to the text box - not to the drop down date picker. How would I assign the theme to the drop down section of the date picker?
It is not as straightforward as merely assigning the class name to the textbox or the date picker. JQuery UI uses a lot of components to build the Date picker, which is why I suggested you to rely on their ThemeRoller rather than you manually write one.
Another reason not to rely on your own CSS is in case if you upgrade JQuery UI in the future, it is possible that the Date Picker component is implemented differently and your CSS that worked before may no longer work after the upgrade.
5

You can add your CSS property background for your theming on the following line in file jquery-ui-1.8.6.custom.css :

.ui-datepicker { width: 17em; padding: .2em .2em 0; background: salmon;}

I change background color to salmon and you can set anything for your necessary.

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.