Category "dom"

Angular2+ render a component without any wrapping tag at all

My child-component looks like: ... @Component({ selector: '[child-component]' templateUrl: './child.template.html' }) ... and my parent template like

Dynamic function names in JavaScript

This may seem a bit weird, but can come in handy when creating dynamic event listeners and I'll do my best to explain what I'm trying to achieve. I have a var

Javascript/DOM event name convention

When I started doing web development, I realized Javascript event names were all in lower case with no separators, i.e. "mousedown", "mouseup", etc. And when wo

Call CDN delivered library in Angular Component

I am trying to interact with the HelpScout beacon via their API methods however struggling to interact with the DOM from the controller. I have tried running

About querySelector() with multiple selectors

I had a situation in which I wanted to focus either an input tag, if it existed, or it's container if it didn't. So I thought of an intelligent way of doing it:

Make a button inside an element clickable while the element itself is also clickable

I have a simple sidebar, that has a bunch of list items in it, and a button right next to the list item, like so: I attached a click handler to the <li>

Change JS code in Inspect Element Editor

When I make some changes in html content using Chrome's Inspect Element editor the changes are immediately reflected. But when I make a change in Javascript cod

Difference between document.addEventListener and window.addEventListener?

While using PhoneGap, it has some default JavaScript code that uses document.addEventListener, but I have my own code which uses window.addEventListener: functi

Invariant Violation: _registerComponent(...): Target container is not a DOM element

I get this error after a making trivial React example page: Uncaught Error: Invariant Violation: _registerComponent(...): Target container is not a DOM elem

Replace traditional event call with JavaScript event listener

With the following code: <head> <script type="text/javascript"> function popupMsg(msg) { alert(msg); } </script> </head> <body>

How to get where onclick function is called JavaScript

Can anybody give me the syntax on how could I determine where the onclick event was called. I want to change the h4 content depending on where the onclick came

Empty ActiveXObject("Microsoft.XMLDOM") in IE 11

I am using ActiveXObject("Microsoft.XMLDOM"); to help loadan XML file that I have. I know that IE 11 now support DOMparser, but after reading this stack mover f

How to change the background color of the modified text in a text area

I want to know how to change the background color or may be color of the text that was modified in a textarea. Like suppose, consider a textarea with a pre-defi

What Exception to throw when a web element is found in Selenium Automation [closed]

Currently, I am working on a "Selenium Wrapper Library", where a set of methods are created in order to perform automation on a particular Web

Can multiple different HTML elements have the same ID if they're different elements?

Can multiple HTML elements have the same ID if they're of different element types? Is a scenario like this valid? Eg: div#foo span#foo a#foo

How to catch a "load" event on STYLE tag with IE?

Let's say I have the following code: var style = $("<style/>") .html("body{background:grey; color:white;} /*and more CSS style*/") .on("load", fun

element.getBoundingClientRect is not a function

Why does it said that element.getBoundingClientRect is not a function? I really don't know what to do. Here is my JS: const elementsFadeIn = document.querySele

Internet Explorer leaks click event after adding an overlay in a jQuery mousedown handler

In a mousedown event-handler of a div another new div is created and appended to the body. This new div has position:fixed (can also be position:absolute) and h

How to resolve the C:\fakepath?

<input type="file" id="file-id" name="file_name" onchange="theimage();"> This is my upload button. <input type="text" name="file_path" id="file-path

Assert if there exist a td DOM with a specific text in testcafe

I just started using testcafe, so far I found the documentation helpful to do my test and automate my E2E. I want to assert if a value exists in a td like this