Changing the child element’s CSS when the parent is hovered

First of all, I’m assuming this is too complex for CSS3, but if there’s a solution in there somewhere, I’d love to go with that instead. The HTML is pretty straightforward. <div class=”parent”> <div class=”child”> Text Block 1 </div> </div> <div class=”parent”> <div class=”child”> Text Block 2 </div> </div> The child div is set to … Read more

jQuery selector for inputs with square brackets in the name attribute

I’m trying to select this element which has square brackets in the name attribute: <input type=”text” name=”inputName[]” value=”someValue”> I’ve tried this (which doesn’t work): $(‘input[inputName[]=someValue]’) and neither does this: $(‘input[inputName&#91;&#93;=someValue]’) or this: $(‘input[“inputName[]”=someValue]’) EDIT: As some of you have pointed out, $(‘input[inputName=someValue]’) would never work. What I was trying to do was: $(‘input[name=inputName][value=someValue]’). (But with … Read more

How can I exclude $(this) from a jQuery selector?

I have something like this: <div class=”content”> <a href=”#”>A</a> </div> <div class=”content”> <a href=”#”>B</a> </div> <div class=”content”> <a href=”#”>C</a> </div> When one of these links is clicked, I want to perform the .hide() function on the links that are not clicked. I understand jQuery has the :not selector, but I can’t figure out how to … Read more

Selecting multiple classes with jQuery

I’ve had a good look and can’t seem to find out how to select all elements matching certain classes in one jQuery selector statement such as this: $(‘.myClass’, ‘.myOtherClass’).removeClass(‘theclass’); Any ideas on how to achieve this? The only other option is to do $(‘.myClass’).removeClass(‘theclass’); $(‘.myOtherClass’).removeClass(‘theclass’); But I’m doing this with quite a few classes, so … Read more

Access the css “:after” selector with jQuery [duplicate]

This question already has answers here: Selecting and manipulating CSS pseudo-elements such as ::before and ::after using javascript (or jQuery) (25 answers) Closed 7 years ago. I have the following css: .pageMenu .active::after { content: ”; margin-top: -6px; display: inline-block; width: 0px; height: 0px; border-top: 14px solid white; border-left: 14px solid transparent; border-bottom: 14px solid … Read more

Using jquery to get all checked checkboxes with a certain class name

I know I can get all checked checkboxes on a page using this: $(‘input[type=checkbox]’).each(function () { var sThisVal = (this.checked ? $(this).val() : “”); }); But I am now using this on a page that has some other checkboxes that I don’t want to include. How would I change the above code to only look … Read more