rahRah rahRah - 3 months ago 21
Javascript Question

Why does my CSS stylesheet not reflect when I pass conditional radio buttons through jQuery/javascript?

I have been struggling with this for weeks now and I don't know how to get past it. I have a pretty nice CSS style sheet to use with a form. The form has a conditional yes/no radio box that I finally got to work using javascript BUT the CSS styling is completely eliminated. Can someone please help me. I'm beyond confused at this point.

Answer

Your fiddle is updated, before you click on the link, two things:

1. Your HTML was duplicated hence the "style break"
2. You use a lot the symbol > in your CSS I suggest to NOT use excesively, the > means "direct children of" example:

<form>
   <div> <!-- The symbol > in css will affect this div only-->
       <div> <!-- Here the symbol > is not taking effect as this is not direct children of form-->
   </dv>

And finally the link to the fiddle

Hope this is helpful...