In JavaScript if I get all li elements with getElementsByTagName(“li”); how do I then only select li elements that are directly followed by span? For example: Here I want only to select 2nd li because it is followed by span immediately and not the first one because it opens with text. Answer the function below collects an li element(how ever
Tag: html
Vue bindings and CSS in HTML does not work
I am trying to display vue within an HTML. It worked properly with the vue cli but now that I am trying to integrate it in a bare HTML file, CSS doesn’t work properly anymore. It might as well has to do with the bindings of vue since the shown bar should repeat three time, but is only shown once.
toggle (enable/disable) between two divs in user form
I’m new in JavaScript (not familiar yet with jquery) and I’m trying to insert some logic into my form. I want to be able to give the user the option to choose between two options (in my example: option_1 OR option_2) and soon the user insert some text to option_1 I want all sub-options in option_2 to become disabled, and
JSON data not working using fs in javascript
I am trying to parse a json file and get some errors. It is in a directory under my js file with the fs in a folder called “recipes” with 3 json files all representing a seperate object. Here’s the json of all 3 that are similar: My code is this: It gives an unexpected JSON position 1 Answer readdirSync
Correctly Overlay DC.JS (D3) canvas elements
It seems that there’s somethings specific to canvas implementation of DC.JS’s scatter plot, that when resizing the window, the canvas element doesn’t respect the positioning of the axis. due to the movement of the title pre-window resize with canvas without canvas It seems likely this is caused by absolute positioning of the canvas element. I’m trying to find a workaround,
HTML & JavaScript – can’t unmute html5 video
I got a very annoying problem. I try for a few hours to unmute an HTML5 video with a ‘muted’ flag, but all that I try doesn’t work. Sadly, that doesn’t work, and removing the muted prop from the code makes nothing, the video stays muted. Is there any solution to force a unmute from the video? Or can anyone
I am having a problem pulling the user’s input and writing it into a page with HTML and JS. Are you able to point out what I am doing wrong here?
Good morning! I am relatively new to the programming game and have just started on my first JS project. I have decided to do a pretty basic budget app. I am having a hard time writing the user input to the page. I assume it has something to do with the input itself or how I call the incomingInput var,
JS, How to change only parent element
I have something like that : Generaly, I use js to change text on my html elements : But do something like this remove my span element on title. Then, is it possible to change only the text on h3 ? I know, i can do something like that: But is not my goal. Answer You can try this:
Is there a way to simplify the detection the index number of a button with the same div class and load it’s corresponding image?
So I managed to get the images I set under the same class to load up their respective fullsized images when clicked on. However, I remembered seeing there was a way to simplify it further? This is what I have so far, that is working out fine, but just needs to be simplified for convenience: Thanks mates! Answer Use the
Is there any way to know when a tab in the browser is covered by a window?
TL;DR: I’m working on a Chrome extension where I need to increase a count only when a tab is visible and not covered by another window. Is there any way to detect this? I’ve tried using the Page Visibility API, but here’s the problem with it: Imagine I have two windows docked side by side. My focus is on tab