jQuery does not recognise @ as attribute indicator. Just remove the @ from your code and enclose the attribute value with ':
$("input:checkbox[name='media_type']").click(function() { if (this.checked == true) { alert('checkbox true'); $("div[class='mediafield']").hide ('fast'); }); On Aug 5, 7:55 am, Old Orange Juice <kc2...@gmail.com> wrote: > I have a bunch of divs with the same classname, 'mediafield': > > <div id="articles" class="mediafield">Slug:</div><br> > <div id="video" class="mediafield">Big Blurb(Video)<br></div> > <div id="content_short" class="mediafield">Big Blub(short content) > <br></div> > <div id="audio" class="mediafield">Big Blub(Audio)<br></div> > <div id="images" class="mediafield">Photo Uri(images):<br></div> > > and I have this jquery code in my header: > <script> > $(document).ready(function() { > $("input:checkb...@name=media_type]").click(function() { > if (this.checked == true) { > alert('checkbox true'); > $("d...@class=mediafield]").hide('fast'); > > });}); > > </script> > > So I know that the click function is getting implemented.. The alert > box appears however I get the following error in firebug: > uncaught exception: Syntax error, unrecognized expression: > [...@class=mediafield] > > Line 0 > > Nothing happens when firebug is turned off... So I'm not sure why it's > throwing the error. > > Any help? > > Thanks, > ooj