How to do a wildcard element name match with “querySelector()” or “querySelectorAll()” in JavaScript?

[id^=’someId’] will match all ids starting with someId. [id$=’someId’] will match all ids ending with someId. [id*=’someId’] will match all ids containing someId. If you’re looking for the name attribute just substitute id with name. If you’re talking about the tag name of the element I don’t believe there is a way using querySelector

Screen Coordinates of a element, via Javascript

window.screenX/Y are not supported on IE. But for other browsers, a close approximation of position is: var top = $(“#myelement”).offset().top + window.screenY; var left = $(“#myelement”).offset().left + window.screenX; Exact position depends on what toolbars are visible. You can use the outer/innerWidth and outer/innerHeight properties of the window object to approximate a little closer. IE doesn’t … Read more

Open new window without focus on it [duplicate]

What you seek is called a “pop-under” window Open a new window using let handle = window.open() Lose focus of the new window by using handle.blur() The return focus to your existing window using window.focus() Example: var handle = window.open(‘https://stackoverflow.com/’); handle.blur(); window.focus(); However, it’s not a guarantee as user browser settings may override this behavior, … Read more

White spaces are required between publicId and systemId

The error message is actually correct if not obvious. It says that your DOCTYPE must have a SYSTEM identifier. I assume yours only has a public identifier. You’ll get the error with (for instance): <!DOCTYPE persistence PUBLIC “http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd”> You won’t with: <!DOCTYPE persistence PUBLIC “http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd” “”> Notice “” at the end in the second one … Read more

Replacement for deprecated `keypress` DOM event

Since the event is deprecated, you should avoid using it in new code, and plan on removing it from old code. The W3C specification says this about deprecated features: Features marked as deprecated are included in the specification as reference to older implementations or specifications, but are OPTIONAL and discouraged. Only features which have existing … Read more