user1285928
user1285928

Reputation: 1476

How to overwrite input field with CSS

I have a JSF input field which is overwritten by JQuery css file. I want to use Primefaces calendar.

<p:calendar style="" 
            styleClass=""
            id="datetochangepasswd"
            value="#{AddAccountController.formMap['DATETOCHANGEPASSWD']}"
            pattern="MM/dd/yyyy HH:mm:ss" />

Can you help to override the input field? I want again to use the default browser style.

P.S. This is the css style that I see in Firebug.

<input id="form:datetochangepasswd_input" class="ui-inputfield ui-widget ui-state-default ui-corner-all hasDatepicker" type="text" name="form:datetochangepasswd_input" role="textbox" aria-disabled="false" aria-readonly="false" aria-multiline="false">

How I can overwrite it?

Upvotes: 0

Views: 906

Answers (2)

seangates
seangates

Reputation: 1522

It appears you're using the datepicker from jQuery. Remove the jQuery datepicker instantiation and it should fix itself.

Upvotes: 0

chris
chris

Reputation: 36957

As someone pointed out in the comments of your original post, CSS does not alter the content displayed/generated in the field. If your field has values that you do not wish to have then that is something either hard coded into the JSP somewhere or in the HTML itself.

However if your forms are just merely different in look than you'd like, as someone else pointed out you can remove the class attribute on the fly with jQuery but this would be a moment after the page loads, and is also dependent of how the jQuery styling and JS are laid out, chances are jQuery UI is called after jQuery itself so it will override most of what you hope to do. Of course thats what document ready is for though.

Also you could always include a CSS file after the jQuery UI css file, and include it on the pages you want to have the forms back to default as you put it, and just recreate the class names you see in your example above to display differently. All in all there is about a dozen ways to alter that styling that come to the top of my head right off the bat.

Overall its more about how you have everything laid out as a whole, and what your really trying to do in the end. Unfortunately your inital description doesn't give much to go on.

Upvotes: 2

Related Questions