I’m making a webpage that has two different navbars… Lets say I named them navbar1 and navbar2.. soo the navbar1 is being used on the home page of the web site and navbar2 on all other sub pages… I have written a pure Javascript function that checks if the navbar1 exists in DOM and if it does then it does
Tag: dom
How to get all the favicon from the site, by url
Here is my parser: It returns an array of URLs, with all URL favicons. How can the user get these favicons? when entering the URL in the input and get the favicons. Like google labels, we enter the URL and get the labels with the favicon How can I do the same thing? Answer I hope this example would help:
How to increase, decrease and reset the counter in dynamic web application
Here we have counter application to increase, decrease and reset the counter by using HTML, CSS, and JavaScript, but I can’t getting to do how we can increase the counter and decrease the counter and reset the counter. When the HTML button element with the id decreaseBtn is clicked, If the count is odd then decrease the counter value by
loop document.getElementsByClassName
I should loop document.getElementsByClassName but first doing a check. For just one element I would do this: But I have to repeat it for more elements and I never know how many there are. I would need such a loop but with the verification document.getElementsByClassName (‘lazyload img-responsive wp-post-image’) [0] .getAttribute (‘width’) <500 first. How could I solve? Thanks Answer Not
Contents.js blocking page load chrome extension
Hey guys so I’m building an extension but I have a function that is heavy when running and it’s blocking the load of the page and I was wondering if it was possible to only run it after the page is fully loaded and interactive either in the script or in manifest.json? I currently have it inside a window.onload but
scrollIntoView() looping element on puppeteer
I want to scrape a list of posts while the page scroll is infinite loading. I want scrollIntoView() for each element in the loop. my code is temporarily like this and the result when the page is loaded, it bounces out but no error. For example, I want to take 20 posts and then the scraper will take the posts
Playwright Select frame with dynamic name
I need to access an iframe in playwright that has a name that is automatically generated. The iframe’s name is always prefixed by “__privateStripeFrame” and then a randomly generated number How i can access the frame with the page.frame({name: }) ? From the docs it seems like i can’t use a regular expression! Answer The frameSelector doesn’t need be specified
Creating a packing list using Javascript, DOM, and the replaceChild() method
I am making a packing list for my assignment and we choose any place and any 3 items to bring. What is supposed to happen is the user presses the 1, 2, or 3 buttons and a prompt will appear telling the user what they want to swap the chosen item with. Then, once they hit OK, the new item
How to add style for specific words at HTML using JavaScript?
Could someone help me to write JS function which will take a string(word) as an argument? And then add an additional style (change color for example) for all these words in the HTML. I don’t know where it is located. This “word” can be inside <div>, or <p> or even <b>. Example: HTML: Call function: Result: All of the “Hello”
Scroll event JQuery – Detecting bottom page
Im trying to make an infinite scroll page. The script works well on my computer (Chrome) but not on my friend’s computer (chrome too). I saw it does work when it comes to detect the bottom of the page when the content at the bottom was append via ajax. I also saw that the loading content works once i change