2022 Developer Survey is open! Take survey.

Questions tagged [query-selector]

A JavaScript function that returns the first element within the document (using depth-first pre-order traversal of the document's nodes) that matches the specified group of selectors.

Filter by
Sorted by
Tagged with
2 votes
1 answer
72 views

Selectively printing elements on web page using a bookmarklet

There is a web page I visit which I would like to print. However, I only want to print a couple of things on it, not everything. So, I am making a bookmarklet that I can use whenever I visit the page ...
user avatar
  • 221
4 votes
1 answer
63 views

Improving the speed of the injection of class element selectors to HTML tables (sometimes nested) at scale through loop iteration or other methods

Background and Code I am using the following JavaScript code to inject CSS classes into a webpage after the page has loaded. These classes act as selectors that I can use to pinpoint a table cell to ...
user avatar
1 vote
0 answers
28 views

MySQL select statement for retrieving user role permissions

I have a java project that I'm working on and I'm trying to implement in my application role-based authentication. So for example when a user is logging and he is an admin he will have access to some ...
user avatar
  • 151
2 votes
1 answer
63 views

jQuery selector

As you can see, I am running a function for each of td of a specific table for finding text of the selected td. I have to change text inside that div so instead of coding more each function for change ...
user avatar
5 votes
2 answers
115 views

JavaScript / jQuery selector value function

I have the following function which opens a modal and puts some value into a div. It works but the function looks ugly, I hope for improvements (maybe more dynamic). ...
user avatar
  • 171
5 votes
1 answer
1k views

Dynamic attribute key selector

I'm basically trying to build a function that searches all nodes on the DOM to check for data attributes, then swap them out with whatever is stored with the "data-intl-" attribute. For example, if ...
user avatar
  • 93
2 votes
1 answer
935 views

Efficient Traversal and Manipulation of the DOM with Native JavaScript Using For/In Loop

With native JavaScript, I intend to traverse a collection of elements in the DOM that contain a link and an image (and possibly other elements). The image may or may not be inside the link—in ...
user avatar
15 votes
2 answers
364 views

Hmm, a thoughtful library

I've been writing far too many routines in JavaScript that get a record from a an object or array based off a matching property, much like jQuery does with DOM elements. Since all the good names are ...
user avatar
  • 32.4k
2 votes
2 answers
170 views

Showing/hiding a box containing a Facebook profile

I see that there are quite some words that are appearing double or more times in my code. I'm thinking there might be a more efficient way of writing this code, only I don't have the knowledge to do ...
user avatar
8 votes
1 answer
722 views

Very fast query selector

A few months ago, I wrote a query selector that seems to outperform the query selectors in the popular GP libraries by a pretty hefty margin. I'm wondering if I overlooked something. It seems odd that ...
user avatar
  • 4,531