Member Offer
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Disable a stylesheet using jQuery

Discussion in 'Website Design Forum:' started by tbwcf, May 8, 2009.

  1. tbwcf

    tbwcf Active Member

    Hi All,

    I have a form built using wuforms and have my own css for the styling.

    The form is pulled into my page using js (iframe type thing) and pulling in its own css... rather than having to go through the masses of css to overwrite it...

    I am pretty sure I am right in thinkinking that I can use JQuery to locate and disable a particular style sheet (ie their one that I dont want in there!)

    I'm googling it up now but having not progressed as far as I want with jQuery think im gonna struggle to peice it together...

    Can anyone help?????
  2. how about doing this instead (changing it to go to your CSS instead?)
  3. Dunno if that will help or not of course LOL :D
  4. tbwcf

    tbwcf Active Member

    Hi Chris, thats the kind of thing! - I just need do it without having to click anything and unfortunately am too dumb to work it out...

    Also as its being pulled in by an iframe type thing I'm not sure that it is possible after trying to look into it further... doh!

    The good news is my learning jquery 1.3 book came in the post today! (but its at home) - and I probably don't have time to work it out - gonna keep on just with the custom css for the time being!

    Thanks for your help Chris!
  5. no worries mate :) always happy to help :D

    As for forcing it to change through the iFrame, that should be possible as long as you can get to the information (PHP or HTML or whatever it is) coming into the iFrame. Then you should be able to force the jQuery there making it change from using its own CSS to yours.

    If you need any help with this going forward :) let me know :D
  6. tbwcf

    tbwcf Active Member

    unfortunately I can't as its pulling in the wufoo form I created.... but it has too look bespoke... getting there by manipulating the css but its slow work finding the bits I need to overwrite from their code...
  7. darren

    darren Member

    Hrm, I was doing this the other day. Not the whole stylesheet but switching out classes on a div in response to a user action.

    Basically.. the form needed to have at least one checkbox checked from an array of them. So I used JQuery and if the user had not checked at least one.. the border color of the div containing the checkboxes was changed to a red color. green if it was a go... same for the rest of the fields...

    Anyway.. to dynamically switch a style class associated with a HTML element like a div you can use the removeClass() and addClass() functions...

    Attributes/removeClass - jQuery JavaScript Library

    so you "could" accomplish what you want to do using that , by removing all classes, but thats probably a bit of a hack...

    So .. here you go. Just switch it for a blank one..

    Switch stylesheets with jQuery |

Share This Page