selectors-api Questions
1
Solved
I'm confused why $1 is firstBB, The querySelector('.aa .bb') call should execute under #root element.
const $1 = document.querySelector('#root').querySelector('.aa .bb');
const $2 = document.qu...
Maricela asked 25/9, 2023 at 16:13
3
Solved
I have a requirement where I have to pickup the last .div within a container and apply some business logic to it. The selection of the last .div has to be dynamic because the user has the option to...
Gretna asked 11/9, 2013 at 7:31
3
Solved
How should I escape attributes in the css/js attibute selector [attr=value]?
Specifically, is this correct?
document.querySelector('input[name="test[33]"]')
I'm looking for the "standard way" o...
Strategic asked 21/12, 2012 at 10:1
6
Solved
Is it possible to make a search by querySelectorAll() using multiple unrelated conditions? If yes, how? And, how to specify whether those are AND or OR criteria?
For example:
How to find all forms,...
Dutchman asked 30/11, 2015 at 15:20
4
Solved
On a page I'm doing I will be ending up with custom link elements like this:
<link rel="multiply" type="service/math" src="path/to/service">
<link rel="s...
Steepen asked 28/5, 2013 at 12:0
8
Is there a way to do a wildcard element name match using querySelector or querySelectorAll?
The XML document I'm trying to parse is basically a flat list of properties
I need to find elements that...
Tiphani asked 3/1, 2012 at 14:54
9
Solved
From what I understand the HTML5 spec lets you use IDs that are numbers like this.
<div id="1"></div>
<div id="2"></div>
I can access these fine using getElementById but ...
Mercurous asked 30/11, 2013 at 22:6
4
Solved
This seems like something that would have a quick answer, but I can't find one. Maybe I'm searching the wrong terms? No libraries please, though I don't need cross-browser fallbacks, I'm targeting ...
Spiritless asked 29/10, 2012 at 16:34
1
Solved
My problem appears to be quite similar to this problem: Document.querySelector returns null until element is inspected using DevTools, however there are some significant differences that are quite ...
Brutify asked 12/1, 2022 at 2:3
3
Solved
I'm writing a parser that should extract "Extract This Text" from the following html:
<div class="a">
<h1>some random text</h1>
<div class="clear"></div>
Extract T...
Renitarenitent asked 21/2, 2019 at 14:38
3
Solved
I wonder if it's possible in Javascript to get the currently selected options in a <select multiple> field using the Selctors API rather than a "stupid" iteration over all options.
select.qu...
Porshaport asked 23/3, 2013 at 12:6
2
Solved
I want to get all innerText of a whole column of a very long html table (random length).
I'm using this code:
var tbEls = document.querySelectorAll('#tBodyID tr td:nth-child(cidx)');
Where cidx ...
Atavism asked 4/8, 2016 at 18:21
14
Solved
How can I find DIV with certain text? For example:
<div>
SomeText, text continues.
</div>
Trying to use something like this:
var text = document.querySelector('div[SomeText*]').inne...
Attainder asked 8/5, 2016 at 9:41
6
Solved
I've an element in the DOM:
<a href="#" data-a="1">Link</a>
I want to get this element via its HTML5 custom data attribute data-a. So I write JS codes:
var a = document.querySelector...
Nisa asked 11/2, 2013 at 9:46
6
Solved
Is there anyway to use a pseudo selector with Firefox's querySelector() or querySelectorAll() functions to detect visibility? In particular I want to be able to do something like this:
elem.queryS...
Stoppage asked 14/11, 2012 at 22:38
8
Solved
Is it possible to change a CSS pseudo-element style via JavaScript?
For example, I want to dynamically set the color of the scrollbar like so:
document.querySelector("#editor::-webkit-scrol...
Jayson asked 19/12, 2010 at 3:41
2
Solved
The following statement gives me the first element with the class titanic
element = document.querySelector('.titanic');
How would I retrieve the second element with the same class?
Pekoe asked 7/4, 2014 at 2:0
3
Solved
I'm trying to use document.querySelectorAll for all checkboxes that have the value attribute set.
There are other checkboxes on the page that do not have value set, and the value is different for ...
Copal asked 27/5, 2012 at 22:18
3
Solved
Let's assume we have this HTML structure:
<div id='test-div'>
<div class='random-class-1'>
<div class='useless-element-1'>
</div>
<div class='useless-element-2'>
...
Singletary asked 8/2, 2017 at 23:12
10
Solved
I have some jquery-like function:
function(elem) {
return $('> someselector', elem);
};
The question is how can i do the same with querySelector()?
The problem is > selector in que...
Bloomers asked 26/6, 2011 at 1:36
3
Solved
What is the jQuery equivalent of querySelector? The only way I've found so far is to select all then pick the first selection:
$(selectorString)[0]
With the above expression, is jQuery smart eno...
Faubourg asked 3/4, 2012 at 18:50
2
Solved
I ran across some JS code using the following to select the first of multiple nodes.
querySelectorAll()[0]
Isn't the following doing the exact same thing?
querySelector()
Is there an advantag...
Dreibund asked 21/10, 2017 at 21:40
9
Solved
Mozilla states that "for of loops will loop over NodeList objects correctly". (source: https://developer.mozilla.org/en-US/docs/Web/API/NodeList) However, this doesn't work in Chrome 43. Is this in...
Thermocline asked 15/6, 2015 at 1:31
2
Solved
I can't seem to find the correct syntax for iterating through the innerHTML of a nodelist in Nightwatch. I'm trying to return the urls of every 'a' tag contained within the body content of a page, ...
Teredo asked 10/11, 2015 at 15:19
1
Solved
I have a list/group of checkboxes, that made by php; put in name="item[]" html property, and then follow with this:
var list = document.querySelectorAll("input[name^='item[']")
So far, works we...
Esposito asked 7/6, 2017 at 16:8
1 Next >
© 2022 - 2024 — McMap. All rights reserved.