I’ve posted a similar question regarding switching HTML text snippets (see JS Switch HTML content based on specific text included in h1 tag), for which the replies were hugely helpful. From these replies, I used the following code to change the HTML text snippet: I now wish to modify the code to change the img src depending on some text
Tag: javascript
How to add custom values to nodes of plotly graph
I’m trying to add values to nodes of plotly graph but there is an issue. Code: var values = nodes[nodeIndex].value; is not able to access the node values. Suggestions on how to fix this will be really helpful. EDIT0: I made the corrections suggested in the answer below but the I am still not able to see the line graph
Dynamically add segment urls to #EXTINF while generating manifest with JavaScript
I am generating a playlist manifest and playing the generated m3u8 file using HLS. I am looping over all the segment files to add their urls to #EXTINF:, but when I run my function, I get the error below, which means it’s not properly receiving the urls: Here’s my code: Answer somehow I bet you haven’t read the basics of
How to make object which store unique key have multiple different values
How to return object in such a way which should have unique key which store mulpltiple values Expected Result = Answer this function should return the result as you asked.
Cypress select li and click on child span
I am trying to select li and click/check on span which is checkbox but, can’t do that. Here, following I tried. Here, in above code I want to select li where “abc account” and once found want to click on span which have class tree-checkbox. So, I tried. But, it says there are multiple elements found. above code find the
Get image from object and display on HTML
I want to get an image from an object in JavaScript and display it via HTML. The text parts are working fine, like the movie name etc., but I cannot see my image. The only thing I see is black_adam.jpg as text. The image is in the same folder as my index.html. I tried to add a slash in front
Why does startAfter in this firebase query isn’t working?
I have the next function using firebase in an JavaScript app. The query works fine the first time because lastDoc isn’t defined so it gets the first 7 documents in the database, but the next time when there’s a lastDoc, the query keeps returning the same first 7 docs. The lastDoc variable is updated and indeed gets the value of
How to populate JSON data into HTML form with fetch()?
I want to populate HTML form input fields with JSON data I get from my API. I can display the data in a table with the following code, but I cannot make it work with a form. I tried to address the form with something like or instead of and , but it doesn’t work. Does anyone know if I
Jquery sort div based on multiple conditions
I have this short bit of code to sort / ascend div by number. But I want to add other conditions to sort by. Right now, it’s only sorting it just based on points class. But I want it to also apply conditions on times and combine with points. Generally these divs sort ascend from large number to low number.
Try to hide a class when “mouseleve”?
I try to solve a problem. I have a video player on my website. I want to manipulate some classes i created like the navigation bar on the bottom of the video. The video player has a navigation bar. I want to hide the navigation bar when my mouse is not above the video: I try to move hide the