471 questions
0
votes
0
answers
74
views
Why can I not get this querySelectorAll to work? [duplicate]
I have an xmldoc with an SVG element that I am trying to pre-process and clean up to do some things. The actual file has several thousand elements, and I want to remove the ones I do not want in the ...
1
vote
2
answers
266
views
Default text reappears after being overwritten with intended text using Selenium Python
I am trying to extract bus prices between 2 cities in Ontario, Canada. I am using Selenium/Python to do this:
The website is here and it has default cities and dates.
Here is my Python code:
from ...
3
votes
2
answers
89
views
JavaScript DOM manipulation in the Browser [closed]
I am trying to get an element, and element's fontSize property and update the size with keypresses. I press the up'ArrowUp' and down 'ArrowDown' but nothing happens, the fontSize property does not ...
0
votes
0
answers
81
views
Firefox remote debugging for website in python - Select element inside an iframe
I am trying to create an automation tool for scraping a site. As part of that, I am making a Python script that utilizes the Remote Debugging protocol through this library: https://github.com/jpramosi/...
1
vote
1
answer
78
views
How to get the nth DIV of a tag in HTML using VBA and selectors for export to Excel
This ist the HTML of a public website:
<div class="flex flex-col md:flex-row mb-[1.0rem]">
<div class="align-text-top pr-1 md:pr-7 w-41">NUMBER:</div>
<div class="...
0
votes
0
answers
183
views
How to scrape searched youtube videos with puppeteer
I am trying to use nodeJs with puppeteer to scrape for YouTube video information from the search results. Unfortunately, for some reason, the scrape doesn't load the elements via the document query ...
0
votes
0
answers
50
views
element.click() doesn't do anything (Chrome extension - injected script)
I'm injecting a script which is supposed to click on an element as soon as it appears on the browser page. It is able to find the element, however .click() doesn't actually click it, despite ...
0
votes
1
answer
61
views
Using a class to open same popup using document.querySelector
I have a popup login box on my site, I use <a class="logincontent">Login</a> which then calls up this function:
document.querySelector('a.logincontent').onclick = () => {
...
1
vote
1
answer
229
views
How to parse content from HTML-code of a public website using VBA & MSXML2.XMLHTTP?
On this public website, depending on the selected federal state, 30 properties are listed on the right-hand side. If this federal state offers more than 30 properties, then another 30 are listed on ...
0
votes
1
answer
1k
views
How to add an 'Enter' key event listener to an input bar that I've grabbed with querySelector?
Basically, I'm following this exercise
https://www.youtube.com/watch?v=EerdGm-ehJQ&t=50183s
14n, part 2.
My page looks like this:I'm focusing on the input bar with the '3' inside it
When I press '...
0
votes
2
answers
167
views
How to insert HTML using querySelector & modules?
My website uses this in the frame.html head so it appears globally:
<!--START: infopages-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></...
-1
votes
1
answer
85
views
querySelector does not work on event.target
I have onClick function but I cannot access to its children elements from the event
<div className="sortingBy" onClick={openSoring}>
<div className="checkBox" ></div&...
3
votes
2
answers
143
views
Using querySelector in Typescript: why does it accept HTMLElement return type?
querySelector can return any subtype of Element. On a webpage this would almost certainly be either HTMLElement or SVGElement. The two are not compatible, and yet TypeScript seems happy for me to ...
3
votes
3
answers
72
views
Access buttons of a div as an array
This is a problem I was having:
I am trying to access the button inside of the div and make each of them log its own text content on click. But all of them display all of the text content. And it has ...
0
votes
1
answer
234
views
How to use sibling combinator together with `:scope` in `querySelector`
Let's say I have an element and I want to select the next matching sibling. Normally, in css I'd be able to write <some selector for this element> ~ <selector for sibling>, but the sibling ...
0
votes
1
answer
169
views
How to detect if Youtube ad is currently playing with JavaScript
In JavaScript I need to detect if YouTube ad is currently playing, my code is not working for me. This is a single page personal project no need to use YouTube Data API.
function ...
2
votes
0
answers
147
views
querySelector does not work as expected in Vue components
I'm new to vue.js and I've encountered a problem that I can't fix.
In my SelectField.vue component I have written the following method:
getModalBodyElement() {
return document.querySelector('....
1
vote
1
answer
80
views
in Firefox querySelector with attribute while finding path in svg gives error
My code is working well in Chrome but not in Firefox.
When I search path element using querySelector with attribute Firefox gives an error that path is not found.
defs.appendChild(svgGradient);
const ...
0
votes
1
answer
87
views
How to extract data from this website with VBA queryselector
I need to extract the 'href' from the html code of this website that is public and without any login:
(To access the page via xmlhttp, it needs a REFERER, that is posted as REFSTRING)
Public Website
...
0
votes
2
answers
85
views
How to select all the input elements except for the ones within a specific element
I want to select all the inputs in a form except those within a specific element.
Consider the following sample HTML:
<form id="myForm">
<input />
<input />
&...
1
vote
4
answers
133
views
Use wildcards to trace an a.href in the querySelectorAll NodeList
Let's say that instead of looking at the ID, I want to select all a.href elements that contain (a piece of) this example: if document.url is "www.youtube.com".
var youtubeID = document....
0
votes
0
answers
49
views
If I only have access to a Node, how can I achieve something like Element.querySelector?
Assume you're not able to access an Element type, only a Node type. (I have this constraint because I'm using inject(ElementRef) in Angular, but there are other cases where it might happen)
A Node ...
0
votes
0
answers
25
views
Replacing Text using Javascript
const text5 = document.querySelector('#p3');
text5.textContent = "Hello World";
div#Can span#Orig {
display: show;
}
div#Can:hover span#Orig {
display: none;
}
div#Can span#p3 {
display: none;...
-1
votes
2
answers
73
views
document.querySelector is returning null for a very simple beginner problem. I have no idea why [duplicate]
html is basically boiler plate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="...
2
votes
0
answers
53
views
Finding elements in Flask + Jinja
I am trying to create an flask app that uses Jinja templating. I have a navbar that contains links with the class name 'nav-link'. They are in base.html. I dynamically create index.html. Later I try ...
0
votes
1
answer
83
views
In Javascript, how can I querySelector to get the innerHTML excluding one of the inner sibling divs
I have the following html:
<body>
<span class="comment">
EXAMPLES:
<p><i>Example 1</i> - <a href="https://example.com/1">...
1
vote
1
answer
405
views
Tidio Custom Chat Button Not Showing Chat Widget
I have been going round and round on this. I can't seem to get the button to open the chat widget on my website. It works fine in the codepen I have.
<button class="chat-button">Live ...
0
votes
0
answers
72
views
Why querySelector show 2 different way of result in Edge console?
I have a div element by id "test", and here is my javascript code:
const test = document.querySelector("#test");
console.log(test);
Then I open the console of Edge, but the result ...
1
vote
0
answers
534
views
I don't understand how to correct this
Hey I'm a new coder and I'm using freecode camp to learn js. I'm currently on the calorie counter exercise and I'm duplicating the code in VsCode. I just added an addEntry button to the js using a ...
0
votes
0
answers
36
views
scripts.js:146 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'querySelector') at elegirCarta
Good morning, I'm doing a school practice named pokemon ultimate battle experience the game consists of 10 cards (5 for the player, 5 for the PC), when you click in a card, it goes in the middle, the ...
1
vote
1
answer
151
views
Getting textcontent from multiple elements individually using one class name
I am developing a calculator as a part of the frontEndMasters course but I cannot get the numbers to work, number seven only works. I would like to know if there is any workaround for this since I ...
0
votes
1
answer
59
views
Selecting an element ID that was created in an innerHTML variable
How do I select the textfield element "member-name"?
function revealPaywall (){
const paywall = document.getElementById('paywall')
const name = localStorage.getItem("value");
//...
0
votes
0
answers
16
views
Unable to print the HTML lines from paragraph through queryselector from DOM [duplicate]
I wrote a rock, paper, scissor game and set the score in local storage using getItem and setItem .I wrote a paragraph with class=jsscore and tried to display the HTML content inside the script with a ...
0
votes
2
answers
370
views
Select certain elements while avoiding other nested elements
I want to find and replace some of the *innerHTML *with regex. I want to do this across a document acting on everything except anchor elements.
I thought I could do this with queryselectorAll, by ...
-1
votes
1
answer
330
views
Why could document.querySelector() be returning null in this case? [closed]
What could cause queryselector to not find an element in such a scenario
function load_home(){
//this function has a lot of fetch calls and creates a lot of divs
}
document.addEventListener("...
0
votes
1
answer
599
views
Syncing React's useEffect with document.querySelector()
I have different groups of items. When the user selects a group, the list of items updates and I then want to add a class to all the items in the selected group.
I'm trying to use useEffect to render ...
0
votes
0
answers
43
views
Weird querySelector interaction (not clicking)
Basically, I have this piece of code:
if (this.variantId || theme.config.mqlSmall) {
this.addEventListener('click', this.onHoverHandler.bind(this));
this.querySelector('a')....
0
votes
1
answer
309
views
How to use `querySelector` to select an element whose label has a colon?
For example, we have this XML:
<?xml version="1.0" encoding="UTF-8"?>
<xml xmlns:media="http://search.yahoo.com/mrss/">
<media:content></media:...
0
votes
1
answer
1k
views
How to target ALL elements in shadow-root?
I am trying to add a class to an element inside of the shadow root for 3 slides within a carousel. Here is my code:
let modalFlexDisplay = document.querySelector("#ipm-ad-modal-div")
...
0
votes
0
answers
74
views
How to use Javascript to expand Google PAA section?
I want to get the questions and answers from People Also Ask section of google using javascript (but inside a vb.net cefsharp browser using executequery). The section needs to be clicked to be ...
0
votes
1
answer
87
views
javascript: querySelector containing @ symbol is invalid
I have an element with a className containing an @ symbol.
Such as <div class="modify@s">
I can easily style this via a css selctor such as .modify\@s
But I can't use this selector to ...
0
votes
3
answers
2k
views
querySelector: how not to call function when return is null?
I need to execute a function on an element that may or may not exist in the DOM, using a querySelector (not querySelectorAll, because there will be at most one such element). The most elegant solution ...
0
votes
1
answer
36
views
DOM, changing HTML
I have a question about adding/removing in HTML.
I have a list, with, say, 3 li. to add one more li I can use either(coach's ) :
const myList = document.querySelector("ul");
const myItem = ...
0
votes
2
answers
87
views
How to find multiple elements in HTML by comparison to an array of data attributes?
Given HTML:
<div class="element" data-name="cat">
<div class="element" data-name="bird">
<div class="element" data-name="dog"&...
0
votes
0
answers
66
views
Remove class of a div when clicking on another in vanilla JS
(Sorry for my English, it's not my native language)
I created a function that widens a wrapper containing a visible small element and display an invisible element (map). If I click on another wrapper, ...
-1
votes
1
answer
44
views
create fn for chenge CSS style in js
I need to create a function for changing the CSS Style like the below:
(because I use this several times in my code)
document.querySelector('.number').style.width = '30rem';
document.querySelector('....
0
votes
0
answers
37
views
query selector regex to match /blahblah/ [duplicate]
I got a page that contains many a tags. I need to select those who has "/[a-z]/" pattern in their href prop.
I wrote something like this:
document.querySelectorAll("a[href='/a-z+/']&...
0
votes
2
answers
285
views
How to override (monkeypatch) the document and element specific `querySelector` implementations and how to restore each original functionality again?
I have a local testing environment, where I want to temporary override querySelector. I know that monkeypatching is bad practice, but in this case this code will only be used locally on developer side....
1
vote
1
answer
596
views
What's the difference between querySelector() and getElementBy[Id/ClassName/TagName]? [duplicate]
I don't get the difference between using querySelector() and, let's say, getElementById(). I understand that querySelector retrieves an element by using any selector, which makes it more versatile.
...
6
votes
1
answer
88
views
why js dom api 'querySelector' select itself
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....