Skip to content

Tag: dom

How can I position my autocomplete box under the search box?

Hello I’m trying to create a custom suggestion box for search box. The parent div is flex box and suggestion box is positioned absolute. but the top and left property of css. It is taking of global page and not parent. You can see in css “suggesetionbox” the top property is targeting complete page not parent div. Can someone suggest

How to get textContent including childNodes?

I have some plain text content in paragraphs inside a <main> HTML element. the paragraphs are separated by new lines (n), not in <p> tags, and I would like to automatically wrap them in <p> tags using JavaScript. Example content: Inside of <main> there may be <img> elements. I want the script to watch for these and leave them untouched.

Modifying attributes and texts that follow simple patterns

Here is my initial unuseful code. I would like that the browser works with the following code for the body where [[ … ]] has been cut, and {{ SOMETHING }} is become <span style = “color: red;; font-weight: bold;”>SOMETHING</span>. I have no control on the DOM structure, and the places where [[ … ]] and {{ … }} are

From a page in AstroJS [plugin:astro] location is not defined

In pages/index.astro if I try Then I get Error in text: [plugin:astro] location is not defined export statements in .astro files do not have access to local variable declarations, only imported values. How can I access or import location from a AstroJs page? Answer location is a browser global. It doesn’t exist in Node, which your Astro site will be