Write javascript to get the href link of all links on a page that contain .csv
- User
Write javascript to get the href link of all links on a page that contain .csv
Assistant
Here is an example of JavaScript that will get the href links of all the links on a page that contain ".csv" in their URL:
code// Get all the links on the page var links = document.getElementsByTagName("a"); // Loop through all the links for (var i = 0; i < links.length; i++) { // Get the href attribute of the link var href = links[i].getAttribute("href"); // Check if the href contains ".csv" if (href.includes(".csv")) { // Do something with the href, such as console.log it console.log(href); } }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.