I’m trying to create a web component button but when I add it in HTML the constructor() function is never being called. I’m facing some problems: 1- The constructor() is not being called so my event listener is not being added to the element; 2- connectedCallback () lifecycle is not being called t…
Tag: html
javascript choose one element at a time
I have a code below var border_3 = document.getElementById(“premium__3”); var clicked_3 = false; var border_6 = document.getElementById(“premium__6”); var clicked_6 = false; var border_12 = …
Material second text field label not moving
I am having issues with the label animation on my second text field not moving when the focus, HTML: JS: SCSS: Material 10.0 and compiled with webpack 5.24.3 Any suggestions..? Answer This works for only the first element. Please try :
JavaScript – capture img tags src in variable
im trying to store an image in HTML that comes from a url source in a variable using JavaScript. Could someone show me what code is required? i have started it off… Answer You can use the src property. You can also use the src property to set a new URL for the image if you want to replace it.
How to use Document Object Model in TypeScript?
I’m extremely new to typescript (and JavaScript for that matter), I think I’ve mastered the fundamentals when it comes to TypeScript (variables, arrays, if/else statements etc) but I would like to add functionality to my static webpages and I can’t keep using console logs obviously. My exper…
Loop through a nested JSON object
I’m looking for a solution to loop through a nested JSON object in pure JS. Indeed I’d like to console.log every item and each of its properties. Answer You are accessing an object’s value using its key in json_object[item] so just keep drilling down into the object.
classList.remove[“active”] isn’t working as I expected
I’m trying to make a map gallery which consist in show 3 diferent locations using two buttons (previous and next). I added functionality to the next button but when I click on next, the map doesn’t move and it stays. For the first map that I wanted to show, I added “active” to the clas…
How can I change the color of a paragraph with javascript
I’ve been trying to find something that would make this work but after an hour of trying things I came here. Here is the HTML code: Here is the JS code: From what I have seen the JS code that I am using is the most used one for what I am trying to do but it still doesn’t work.
How to give autofocus to a element when another element has it?
I am trying to give a textarea (which is added when you click on a button) autofocus with the autofocus attribute, but when I do that it doesn’t works and I get this message on the console: So now the question is: How can I get the focus to the textarea when some other element already has it? Answer Giv…
How can I group sections within a table?
I am using Vue with Element UI to create a table. Currently I am trying to figure out a possible way to add a year/name to the popup and hit save to have it show up as one of those headers shown in the ss with ‘add trim’ next to it? Add trim button would add those rows to the