Questions tagged as 'seletores'

1
answer

Which css selector has priority?

My question is very objective. Regarding css selectors. I have the following code HTML and CSS : #element p{color:blue;} .element p{color:red;} div p{color:pink;} div.element p{color:yellow;} div[name="ele...
asked by 01.08.2016 / 19:27
3
answers

How to use $ .on in pure JavaScript: "$ (...) .on (event, selector, function)"?

This is in jQuery we have on , any element <a> with class test e without the foo class will fire the function when clicked, even though you create the element after the event is already added: $("#new...
asked by 06.06.2017 / 21:42
5
answers

Using jQuery, how to select elements with two CSS classes

I have a div that uses two CSS classes. Here's the HTML: <div class="box1"></div> <div class="box1 destaque"></div> <div class="box2"></div> <div class="box2 destaque"></div> <div class="box3"...
asked by 11.02.2014 / 17:03
3
answers

Select elements that contain a particular "date" attribute

On the page there are several elements with data attributes. To avoid going to add CSS classes to the elements, making the page code denser, I would like to select elements by the name of the data attribute. Example <div id...
asked by 14.01.2014 / 15:33
2
answers

How to select element at the lowest hierarchical level?

I need to select the ul parent of the li element being clicked. But as a li stays within the other the javascript understands that I am clicking on li and all li pais. <ul class="lista"> <li clas...
asked by 28.02.2014 / 20:18
1
answer

How to use the first-child selector for a specific class

Hello, I have several divs and some of them have a 'test' class, I would like the first-child selector to highlight only the first DIV that has the 'test' class, however, it only works if the 'test' class is in the first div. From what I underst...
asked by 30.12.2015 / 23:03
3
answers

Difference between attr = val, attr="val" and attr = 'val' in JavaScript?

Is there any difference in using the selector in the following ways, or one that is "correct"? [name="val"] [name='val'] [name=val]     
asked by 06.03.2018 / 19:01
2
answers

What is the inverse of: visible in jQuery?

The :visible selector in jQuery is used to search for an element when it is visible. Example: $(this).find('li:visible').addClass('color-red'); However, when trying to search for invisible elements, we do not have the :invisibl...
asked by 11.08.2015 / 14:29
2
answers

When to use div + selector in CSS

When I'm developing a front-end for a website, I put the name of the selector directly, for example .seletor1 , .seletor2 , and so on. I recently had to work on the classes of a plugin I downloaded, and I saw that it contained:...
asked by 25.06.2014 / 14:04
2
answers

What is the difference between the: nth-child and the: nth-of-type?

Most of the time I use : nth-of-type but I did not quite understand the difference between the two, can anyone explain?     
asked by 12.04.2018 / 19:47