News Articles DOM

how to display a hidden button after document.write(”)?

I’m exploring a mixture of codes in javascript, HTML, CSS, and bootstrap. I tried to clear a page through a button click–> document.write(”), then kinda tried to repaint another button. Kindly explain where I’ve gone wrong, if this is a good practice or not. Sorry, if this is silly. On clicking button one, two things […]

CKEditor4 tab navigation works with Chrome, but not Firefox

I have a problem with CKEditor4, where when traversing through the focusable elements in the modal it’s in with Firefox, after tabbing out of the editor the focus shifts to the modal body instead of the next focusable element. When testing the same with Chrome, the tab navigation works as it should. I’ve tried capturing […]

Replace a DOM element with another DOM element when .parentNode causing error

Working on replacing DOM under one html page, some nodes give null reference error since they are immediate descendants of document.body. I tried to use document.body.replaceChild(newItem, node); when its parentNode is null, but still got DOMException: Failed to execute ‘replaceChild’ on ‘Node’: The node to be replaced is not a child of this node error. […]

Monster 1.26.0 released

Today we released the latest edition of our Monster project. Monster is a collection of javascript classes that we need for daily work in our web projects. Besides small helper functions and classes, it also provides useful functions to enable reactive programming. Monster is available via jsdelivr and npm. Only the changes are described here. […]

v-if not updating after eventbus event

Hi I’m having problems with a v-if that’s not updating after receiving an eventbus event. This is my code : <template> <div class=”main”> <button v-if=”inCreationMode()”> Make a new snippet </button> <button v-if=”mode ===’edit'”>Push edits</button> </div> </div> </template> <script> export default { data() { return { mode: “creation”, }; }, created() { this.emitter.on(“editSnippet”, snippet => function(snippet){ […]

.getElementByTagName not working on chrome

I am trying to use getElementByTagName to call for images in a gallery to show a border upon selection. Chrome keeps spitting back the attached error.Chrome Error Below I am attaching my html and javascript code.HTML CodeJavaScript Source: JavaSript – Stack Overflow

maps to load in fieldset hidden with next button

when the page is loaded map loads fine. When you add it to a fieldset I believe the dom is changing and that’s why when u get to the fieldset with the map all u can see is a gray background. I believe I need to somehow bind $(‘body’).on (initMap) to make the map load […]

Javascript questions from angellist [closed]

[Question 2][1]; [Question 4][2]; They are quiz questions // [1]:`quiz // [2]:`quiz` Source: CSS – Stack Overflow

How can I prevent stopping scrollIntoView when the user starts to scroll by his own?

I have an navbar where I use scrollIntoView to always have the active element in the center of the list. However I discovered when the user scrolls the main content it will interrupt / stop the scrollIntoView. It only works when there is no scrolling from the user. You can in this example: (Code […]

How to appendChild custom component using React JS and Typescript?

I have some code like const ParentComponent=()=>{ let child=<ChildComponent (…props) /> if(condition){ const parent=document.GetElementById(‘parentId’); //Here is a problem parent.appendChild(child); } return <> <div id="parentId"></div> </> } export default ParentComponent; const ChildComponent=()=>{ return <> <div></div> </> } export default ChildComponent; I want to dynamically add child components multiple times but getting an error I am happy […]

DOM is not ready in mounted hook?

Did I get an error for DOM in the mounted hook, how to fix it? I found a dirty fix with the set timeout method, but that is not the solution. setTimeout(() => { … // VanillaJS DOM is ready! // This is extrenal file }, 1000); mounted() { … call imported function from above […]

Stripe card-element not showing on injected script of chrome extension

I would like to inject a Modal popup from content.js in chrome extension that allows the user to pay from the Modal. I don’t get any errors in the catch nor any network erros, nonetheless, the card-element is not showing. I even tried doing async, waiting for document to load & this solution & still […]

Definition CSS via JQuery – only one element

My code: .main-page-wrapper .side-nav > ul:nth-child(3) > li:first-child > a { font-size: 40px; } <div class=”main-page-wrapper”> <div class=”side-nav”> <ul> <li><a href=””>1-1</a></li> <li><a href=””>1-2</a></li> </ul> <ul> <li><a href=””>2-1</a></li> <li><a href=””>2-2</a></li> </ul> <ul> <li><a href=””>3-1</a></li> <li><a href=””>3-2</a></li> </ul> </div> </div> What I need: change element definitions via CSS to defining this element via JQuery. Anyone help? Source: […]

Javascript/HTML DOM: How do I check if text user input equals to string in if statement

I am trying to check in my if statement if the text the user inputs from my html form equals to the string I indicate when submit is clicked. I tried using regular expressions to check if the text is a string, but not sure if done properly. Both if statements end up going straight […]

Can javascript decrease an html value when it’s already going up?

I can’t find a way for when the value is over 180 (using an if statement), it starts going down as a negative, for example: when the value is over 180, the element with the id "text" becomes -179 then as the slider goes farther, it becomes up to -1. Here is my code; var […]

How to use DOM to change background-size with radio buttons (JAVASCRIPT)

I want to ask if there is an alternative approach to this. I am very new to javascript I have 3 radio buttons that will change the background-size of a DIV. I managed to make it possible by using ternary in which it changes background size if its checked. DOM. Apparently the Cover doesn’t work. […]

In Gatsby/React modify DOM where there’s no direct access

I have a Gatsby site where I am getting content from a WordPress site. The bulk of the content comes from a Graphql query and I get it and show it on the page like this: <Grid item sm={12}> <StyledPostContent> {parse(`${singlePost.content}`)} </StyledPostContent> </Grid> Inside of this "singlePost.content" there is a piece of content wrapped around […]

Pausing youtube embedded video

I have a web application that I am building for a client. It has multiple pages that show and hide content when the user interacts with the flow. I am having an issue with the YouTube video embed continuing to play audio in the background because the display of the video is hidden but the […]

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.